zuper-jwt

    0.1.1 • Public • Published

    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.

    Install

    npm i zuper-jwt

    DownloadsWeekly Downloads

    0

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • nicolasparada