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...
|
// your first API endpoint...
|
||||||
app.get("/api/hello", function (req, res) {
|
app.get("/api/whoami", (req, res) => {
|
||||||
res.json({ greeting: "hello API" });
|
res.json({
|
||||||
|
ipaddress: req.headers["cf-connecting-ip"] || req.ip,
|
||||||
|
language: req.headers["accept-language"],
|
||||||
|
software: req.headers["user-agent"],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// listen for requests :)
|
// listen for requests :)
|
||||||
|
2130
package-lock.json
generated
2130
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user