Integrated the authentication middleware into the api server
This commit is contained in:
parent
227ae68555
commit
499a44cad7
@ -2,9 +2,19 @@ import express, {Express} from 'express';
|
||||
|
||||
const app: Express = express();
|
||||
|
||||
// Register the default middlewares
|
||||
app.use(express.json());
|
||||
app.use(require('../api/middlewares/error'));
|
||||
|
||||
/** All routes that don't require authentication */
|
||||
|
||||
|
||||
// Register the authentication middleware
|
||||
app.use(require('../api/middlewares/authenticate').authenticate);
|
||||
|
||||
/** All routes that require authentication */
|
||||
|
||||
|
||||
/** Logs something with an api prefix */
|
||||
const log = (msg: string) => console.log(`[API] ${msg}`);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user