0.0.4 • Published 3 years ago

@teleology/express v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Downloads Version License

@teleology/express

Common utilities for wrapping express endpoints

Installation

yarn add @teleology/express body-parser
# or
npm i --save @teleology/express body-parser

Documentation

Wrapper

The wrapper function is a HOC, and will extract data from the incoming request event. Query, path, and body data will automatically be collected and exposed in the data object. Header keys will be lowercased. Note, this utility makes use of expresses body parser

const express = require('express');
const bodyParser = require('body-parser');
const { wrapper } = require('@teleology/express');

const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

const handler = async ({ headers, data }) => {
  // Some implementation
};

app.get('/test', wrapper(handler));
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago