purescript-httpurple/test/example/NodeMiddleware/Main.js

14 lines
270 B
JavaScript
Raw Normal View History

2022-08-25 09:52:55 +00:00
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();
};