0.7.0 • Published 2 years ago
koas-serializer v0.7.0
Koas Operations
Koas serializer converts a response body to the negotiated response format.
Installation
npm install koa koas-core koas-serializer
Usage
const Koa = require('koa');
const { koas } = require('koas-core');
const { serializer } = require('koas-serializer');
const api = require('./api.json');
const app = new Koa();
app.use(
koas(api, [
serializer({
// Serializers
}),
]),
);
Options
Koas serializer accepts a mapping of mime types to serializer functions. Serializer functions should accept the request body, and return a string or buffer.
The following serializers are supported by default:
application/json
: The body is converted to JSON using the builtinJSON.stringify
.text/*
: If the body is a buffer, it is returned as-is. Otherwise it is converted to a string using thetoString()
method.
0.7.0
2 years ago
0.6.0
2 years ago
0.5.4
2 years ago
0.5.5
2 years ago
0.5.3
2 years ago
0.5.2
3 years ago
0.5.1
3 years ago
0.5.0
3 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.1
4 years ago
0.2.0
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.8
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago