feat: added initial API routers (no routes yet)

pull/180/head
tycrek 2 years ago
parent 49d1a70b27
commit 62b2bf953f
No known key found for this signature in database
GPG Key ID: FF8A54DCE404885A

@ -0,0 +1,22 @@
/**
* Developer API
* - Users
* - Resources
*/
import { Router, Request, Response, NextFunction } from 'express';
import { users } from '../auth';
import { data } from '../data';
const RouterUser = Router();
const RouterResource = Router();
/**
* Token authentication middleware
*/
const authMiddleware = (req: Request, res: Response, next: NextFunction) => {
const token = req.headers.authorization;
(token && users[token])
? next()
: res.sendStatus(401);
};
Loading…
Cancel
Save