This repository has been archived on 2023-02-05. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
get-ip/index.js
2022-12-30 14:50:16 -08:00

13 lines
510 B
JavaScript

const app = require("express")();
app.get("/", async (req, res) => {
fetch("https://api.my-ip.io/ip")
.then(response => response.text())
.then(body => {
res.send(`<body style="background: slategray; color: white; font-family: sans-serif; font-weight: bold; font-size: 4em; height: 100vh; display: flex; align-items: center; justify-content: center;">${body}</body>`);
});
});
const port = process.env.PORT || 8080;
app.listen(port, () => console.log(`app listening on http://localhost:${port}`));