14 lines
270 B
JavaScript
14 lines
270 B
JavaScript
|
export const logger = function (req, res, next) {
|
||
|
console.log("Got a request");
|
||
|
next();
|
||
|
};
|
||
|
|
||
|
export const authenticator = function (req, res, next) {
|
||
|
if (req.headers["x-token"] == "123") {
|
||
|
req.user = "John Doe";
|
||
|
} else {
|
||
|
req.user = null;
|
||
|
}
|
||
|
next();
|
||
|
};
|