forked from kennship/http-echo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (24 loc) · 684 Bytes
/
index.js
File metadata and controls
27 lines (24 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.all('*', (req, res) => {
res.json({
service: process.env.SERVICE_NAME || undefined, // Keys with value `undefined` are omitted during JSON serialization
path: req.path,
headers: req.headers,
method: req.method,
body: req.body,
cookies: req.cookies,
fresh: req.fresh,
hostname: req.hostname,
ip: req.ip,
ips: req.ips,
protocol: req.protocol,
query: req.query,
subdomains: req.subdomains,
xhr: req.xhr,
})
})
app.listen(process.env.PORT || 3000)