diff --git a/index.js b/index.js index 8d3e97d..4226651 100644 --- a/index.js +++ b/index.js @@ -1,21 +1,27 @@ -const express = require('express'); -const bodyParser = require('body-parser'); -const cors = require('cors'); -const helmet = require('helmet'); -const morgan = require('morgan'); -var package = require('./package.json'); +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"); const app = express(); app.use(helmet()); app.use(bodyParser.json()); +app.use(cookieParser()) app.use(cors()); -app.use(morgan('combined')); +app.use(morgan("combined")); -app.get('/api/version', (req, res) => { +app.get("/api/version", (req, res) => { res.send({version: package.version}); }); +app.get("/api/echo", (req, res) => { + res.send({recieved: {body: req.body, cookies: req.cookies}}); +}); + app.listen(80, () => { - console.log('listening on port 80'); + console.log("listening on port 80"); }); \ No newline at end of file diff --git a/package.json b/package.json index 1fbada2..b3b001a 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "dependencies": { "body-parser": "^1.20.1", + "cookie-parser": "^1.4.6", "cors": "^2.8.5", "express": "^4.18.2", "helmet": "^6.0.1",