All Projects → lifeomic → alpha

lifeomic / alpha

Licence: MIT License
Unified client for HTTP services

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Nearley
35 projects

Projects that are alternatives of or similar to alpha

subo
The Suborbital CLI
Stars: ✭ 53 (+152.38%)
Mutual labels:  alpha
music
🎵vue 像素级还原mac客户端网易云音乐
Stars: ✭ 34 (+61.9%)
Mutual labels:  axios
openapiclientgen
Generate C# and TypeScript client codes from Open API / Swagger definitions
Stars: ✭ 31 (+47.62%)
Mutual labels:  axios
axios
Axios module for Nest framework (node.js) 🗂
Stars: ✭ 95 (+352.38%)
Mutual labels:  axios
boss
React+express+sock.io+mongodb build a boss
Stars: ✭ 25 (+19.05%)
Mutual labels:  axios
Code-VueWapDemo
“Vue教程--Wap端项目搭建从0到1”的源码
Stars: ✭ 19 (-9.52%)
Mutual labels:  axios
vue3-webpack-boilerplate
Vue 3 Webpack Boilerplate (Vue 3, Vue Router 4, Vuex 4, Typescript)
Stars: ✭ 69 (+228.57%)
Mutual labels:  alpha
http-interceptors
The Web apps in this monorepo make HTTP requests and require uniform consistency in how they are executed and handled. This monorepo demonstrates the same app written with Angular and with Svelte. Each app uses HTTP interceptors. The Angular app uses HttpClient and its interceptors while the Svelte app uses Axios and its interceptors.
Stars: ✭ 46 (+119.05%)
Mutual labels:  axios
Covid19-Stats-IN
This app helps in tracking COVID-19 cases in India using covid19India apis
Stars: ✭ 13 (-38.1%)
Mutual labels:  axios
serverless-ts-template
Serverless Typescript Template
Stars: ✭ 13 (-38.1%)
Mutual labels:  lambda-functions
energy-use-case-trading-client
Energy Use Case Web UI for Lition Trading Platform
Stars: ✭ 23 (+9.52%)
Mutual labels:  axios
ONE-ReactNative
As a practicing project, ONE - ReactNative contains many of the features we often use, such as Axios,Fetch, Redux, Charts, etc. It is also worth learning that the project contains a complete mall module.
Stars: ✭ 71 (+238.1%)
Mutual labels:  axios
fetchingInReact
💎📷 Fetching data from Unsplash.com in React
Stars: ✭ 23 (+9.52%)
Mutual labels:  axios
vue-element-admin-ts
vue-element-admin 的 typescript 版本
Stars: ✭ 101 (+380.95%)
Mutual labels:  axios
vue-douban
高仿豆瓣app
Stars: ✭ 22 (+4.76%)
Mutual labels:  axios
vue-crud-ui
Single file Vue.js script that adds a UI to the PHP-CRUD-API project
Stars: ✭ 47 (+123.81%)
Mutual labels:  axios
react-meeting-room
A simple web app to book meeting rooms inside an office, built using React and Google Calendar API
Stars: ✭ 101 (+380.95%)
Mutual labels:  axios
aws-serverless-fullstack-swift-apple-carplay-example
This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.
Stars: ✭ 84 (+300%)
Mutual labels:  lambda-functions
nuxt-handson
Nuxt.js Hands-On
Stars: ✭ 24 (+14.29%)
Mutual labels:  axios
login push
vue+koa2+jwt实现单点登录 + todolist增删改查
Stars: ✭ 20 (-4.76%)
Mutual labels:  axios

alpha

License Build Status Coverage Status Greenkeeper badge Known Vulnerabilities PRs Welcome

Alpha is a module that provides a single client interface for interacting with HTTP micro-services regardless of whether they are implemented as Lambda functions or real HTTP servers.

API

Alpha instances are axios clients at their core. This means that they support the full axios API. The difference is how Alpha instances are instantiated. Regardless of how an Alpha instance is instantiated, requests to fully qualified HTTP URLs will always perform a real HTTP request. Requests made to Lambda functions with a Buffer payload will automatically encode the request body using the base64 encoding.

new Alpha(target)

Creates a new Alpha instances. All Alpha instances support the full axios API.

HTTP Targets

When an Alpha instance is created with an HTTP(S) base URL target, requests to unqualified URLs will be relative to the base URL. For example, the following code will dispatch the request to http://example.com/some/path.

const alpha = new Alpha('http://example.com');
const response = await alpha.get('/some/path');

Lambda Function Targets

When an Alpha instance is created with a base URL using the lambda scheme, requests to unqualified URLs will cause the specified Lambda function to be invoked with a synthetic API Gateway event using the optional Lambda alias. For example, the following code will invoke the test-function Lambda function with the named-alias.

const alpha = new Alpha('lambda://test-function:named-alias');
const response = await alpha.get('/some/path');

The lambda URL scheme is interpreted according to the following pattern:

    lambda://<function-name>:<named-alias>

Lambda Handler Targets

When an Alpha instance is created with a handler function target, requests to unqualified URLs will be transformed into synthetic API Gateway (v1) events that will be passed directly to the handler function. This is primarily used for unit testing Lambda handlers.

const alpha = new Alpha(handlerFunction);
const response = await alpha.get('/some/path');

Request Retries

An Alpha client can be configured to retry a failed attempt. A retryable failure currently means a request that failed from a network error or had a 5xx status code.

// Retry failed requests using default settings
const alpha = new Alpha('http://example.com', { retry: true });
// Retry failed requests using custom settings
const alpha = new Alpha('http://example.com', { retry: {
    attempts: 3,        // The number of attempts to make (default 3)
    factor: 2,          // The factor to use for the exponential backoff delay (default 2)
    maxTimeout: 10000,  // The max timeout in milliseconds to delay before the next attempt (default 10000)
    retryCondition: function (error) { } // If function result is truthy, the error will be retried (default is retry network and 5xx errors)
  });

Mocking Lambda

To redirect the Lambda requests to a mocked implementation, either set the LAMBDA_ENDPOINT environment variable, or use the lambdaEndpoint config option:

const alpha = new Alpha('lambda:my-lambda', { 
  lambdaEndpoint: 'http://localstack:4566'
});

The value of this option will be used when creating the AWS Lambda client.

Alpha.dockerLambda(options, clientOptions)

Creates an Alpha client instance that dispatches requests to docker-lambda. This facilitates testing Lambda services in a full mock Lambda environment running in a docker container. The options are passed to the docker-lambda library and the clientOptions configure the Alpha client instance that is created.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].