keyport-express
v1.0.1
Published
Express middleware for the live KeyPort public API
Maintainers
Readme
keyport-express
Express middleware built on keyport-node.
Install
npm install keyport-express keyport-nodeUsage
import express from 'express'
import { keyportLicense } from 'keyport-express'
const app = express()
app.use('/api', keyportLicense({ apiKey: process.env.KEYPORT_API_KEY! }))JSON config file usage
{
"api_key": "kp_live_xxx",
"base_url": "https://api.keyport.sbs/api/v1",
"timeout": 10000
}app.use('/api', keyportLicense({ configPath: './keyport.json' }))API key in code, rest from config
app.use('/api', keyportLicense({
configPath: './keyport.json',
apiKey: process.env.KEYPORT_API_KEY,
}))Notes
keyport-expresswrapskeyport-node; it does not implement its own HTTP client- validated payloads are attached to
req.license - middleware validates only against the live
POST /api/v1/validateendpoint
