Closed divarvel closed 1 year ago
This provides a middleware function (not a final name, please chime in with better suggestions!) allowing to protect an express JS app with biscuit.
middleware
const protect = middleware({ publicKey: keypair.getPublicKey(), priorityAuthorizer: authorizer`time(${new Date()});` }); app.get( "/protected/:dog", protect((req) => authorizer`allow if scope(${req.params.dog}, "read");`), (req, res) => { res.send(`Hello, ${req.params.dog}`); });
Please see examples/node/express.js for a more complete example.
examples/node/express.js
This provides a
middleware
function (not a final name, please chime in with better suggestions!) allowing to protect an express JS app with biscuit.Please see
examples/node/express.js
for a more complete example.