Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/protontype/proton-body-parser
Express body-parser middleware for Protontype
https://github.com/protontype/proton-body-parser
body-parser expressjs middleware protontype rest-api typescript
Last synced: about 4 hours ago
JSON representation
Express body-parser middleware for Protontype
- Host: GitHub
- URL: https://github.com/protontype/proton-body-parser
- Owner: protontype
- Created: 2018-05-10T00:34:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-30T12:10:53.000Z (almost 6 years ago)
- Last Synced: 2024-11-11T13:08:11.826Z (8 days ago)
- Topics: body-parser, expressjs, middleware, protontype, rest-api, typescript
- Language: TypeScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/proton-body-parser.svg)](https://badge.fury.io/js/proton-body-parser)
# Express body-parser middleware for Protontype
This module wraps [body-parser](https://github.com/expressjs/body-parser) Nodejs module for use into a [Protontype](https://protontype.github.io/) project
## Middlewares
- **JsonBodyParserMiddleware**: Equivalent to [JSON body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserjsonoptions)
- **RawBodyParserMiddleware**: Equivalent to [Raw body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserrawoptions)
- **TextBodyParserMiddleware**: Equivalent to [Text body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparsertextoptions)
- **UrlBodyParserMiddleware**: Equivalent to [URL-encoded form body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserurlencodedoptions)### How to Use
```typescript
let app = new ProtonApplication().addMiddlewareAs(JsonBodyParserMiddleware)
app.start();
```With options:
```typescript
let middlewareWithOptions = new JsonBodyParserMiddleware({ type: 'application/*+json' });
let app = new ProtonApplication().addMiddleware(middleware)
app.start();
```For all options see:
* [JSON body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserjsonoptions)
* [Raw body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserrawoptions)
* [Text body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparsertextoptions)
* [URL-encoded form body parser](https://github.com/expressjs/body-parser/blob/master/README.md#bodyparserurlencodedoptions)For how to use middlewares into Protontype see [documentation](https://protontype.github.io/middlewares/)