zuper-jwt
v0.1.1
Published
JWT middleware for Zuper
Downloads
3
Maintainers
Readme
zuper-jwt
JWT middleware for Zuper.
Usage
import { Server } from 'http'
import { Application } from 'zuper'
import { jwt } from 'zuper-json-bodyparser'
const server = new Server()
const app = new Application()
const getUser = req => req.user
app.use(jwt({
secret: process.env.JWT_SECRET,
passthrough: true,
expiresIn: '7d'
}))
app.use(getUser)
server.on('request', app.handleRequest)
server.listen(80, '127.0.0.1', () => {
console.log('Server running at http://localhost/')
})
It uses jsonwebtoken exposing decode
and a promisified version of sign
and verify
.