add echo path,
add cookie-parser to requirements Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
ab027bf278
commit
5b03a331ea
24
index.js
24
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");
|
||||
});
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user