dg-npm-templates
Version:
Npx generator for react app dependency creation by digite
39 lines (33 loc) • 998 B
JavaScript
const express = require("express");
const router = express.Router();
router
.all("/", (req, res) => {
//ALL Request method types on root url to app will come here remove if not needed
})
.all("/landing", (req, res) => {
//ALL Request method types on root url/landing to app will come here remove if not needed
let response = {
title: "Thank you for using a product of Digite",
message: "You can close this tab"
};
if (req.session.hasOwnProperty("message")) {
response = req.session.message;
}
req.session.regenerate((err) => {
if (!err) {
res.render("message", response);
}
});
})
.post("/sample/post", (req, res) => {
// POST api sample
res.status(200).send({
message: `Your message ${req.body.message}`
});
})
.get("/status", (req, res) => {
res
.status(200)
.send({ STATUS: "UP", VERSION: require("./../../package.json").version });
});
module.exports = router;