This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/server/mocks/authenticate.js
2015-03-23 14:17:57 -08:00

22 lines
497 B
JavaScript

module.exports = function(app) {
var express = require('express');
var jwt = require('jsonwebtoken');
var authenticateRouter = express.Router();
authenticateRouter.post('/', function(req, res) {
var token = jwt.sign({
'name': 'Test User',
'role': 'admin'
}, 'secret',
{
expiresInMinutes: 60,
issuer: 'bactdb',
subject: 'Test User',
});
res.send({
'token': token
});
});
app.use('/api/authenticate', authenticateRouter);
};