2023-01-19 20:22:26 +00:00
|
|
|
const express = require("express");
|
|
|
|
const bodyParser = require("body-parser");
|
|
|
|
const cookieParser = require("cookie-parser")
|
|
|
|
const cors = require("cors");
|
|
|
|
const helmet = require("helmet");
|
|
|
|
const morgan = require("morgan");
|
|
|
|
var package = require("./package.json");
|
2023-01-17 23:46:42 +00:00
|
|
|
|
|
|
|
const app = express();
|
|
|
|
app.use(helmet());
|
|
|
|
app.use(bodyParser.json());
|
2023-01-19 20:22:26 +00:00
|
|
|
app.use(cookieParser())
|
2023-01-17 23:46:42 +00:00
|
|
|
app.use(cors());
|
2023-01-19 20:22:26 +00:00
|
|
|
app.use(morgan("combined"));
|
2023-01-17 23:46:42 +00:00
|
|
|
|
|
|
|
|
2023-01-19 20:22:26 +00:00
|
|
|
app.get("/api/version", (req, res) => {
|
2023-01-17 23:46:42 +00:00
|
|
|
res.send({version: package.version});
|
|
|
|
});
|
|
|
|
|
2023-01-19 20:22:26 +00:00
|
|
|
app.get("/api/echo", (req, res) => {
|
|
|
|
res.send({recieved: {body: req.body, cookies: req.cookies}});
|
|
|
|
});
|
|
|
|
|
2023-01-17 23:46:42 +00:00
|
|
|
app.listen(80, () => {
|
2023-01-19 20:22:26 +00:00
|
|
|
console.log("listening on port 80");
|
2023-01-17 23:46:42 +00:00
|
|
|
});
|