typeforce-middleware

2.1.0 • Public • Published

typeforce-middleware

build status Version

Typeforce applied as a connect middleware. Strictness is enabled by default.

Examples

var express = require('express')
var bodyParser = require('body-parser')
var typeforce = require('typeforce-middleware')
var app = express()
 
app.post('/comment', bodyParser.json(), typeforce({
    title: 'String',
    content: 'String'
}), function (req, res) {
    res.status(200).end()
}, function (err, req, res, next) {
    res.status(400).end(err.message)
})

LICENSE MIT

Package Sidebar

Install

npm i typeforce-middleware

Weekly Downloads

3

Version

2.1.0

License

MIT

Unpacked Size

3.76 kB

Total Files

5

Last publish

Collaborators

  • dcousens