Impl: whoami API
This commit is contained in:
parent
f19df338ca
commit
9ad129b937
8
index.js
8
index.js
@ -20,8 +20,12 @@ app.get("/", function (req, res) {
|
||||
});
|
||||
|
||||
// your first API endpoint...
|
||||
app.get("/api/hello", function (req, res) {
|
||||
res.json({ greeting: "hello API" });
|
||||
app.get("/api/whoami", (req, res) => {
|
||||
res.json({
|
||||
ipaddress: req.headers["cf-connecting-ip"] || req.ip,
|
||||
language: req.headers["accept-language"],
|
||||
software: req.headers["user-agent"],
|
||||
});
|
||||
});
|
||||
|
||||
// listen for requests :)
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "request-header-parser-microservice",
|
||||
"name": "@radii-fcc-backend/request-header-parser-microservice",
|
||||
"version": "0.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "request-header-parser-microservice",
|
||||
"name": "@radii-fcc-backend/request-header-parser-microservice",
|
||||
"version": "0.0.2",
|
||||
"license": "MIT",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.1",
|
||||
"dotenv": "^8.2.0",
|
||||
|
Loading…
Reference in New Issue
Block a user