Download server.js from Fred808/Angel-Bot: direct link, hf CLI and curl.
- Browser
- Download file 768 Bytes
-
https://huggingface.co/spaces/Fred808/Angel-Bot/resolve/main/server.js
- Command line
-
hf download hf://spaces/Fred808/Angel-Bot/server.js
-
curl -L -o server.js https://huggingface.co/spaces/Fred808/Angel-Bot/resolve/main/server.js
768 Bytes
| const express = require("express"); | |
| const bodyParser = require("body-parser"); | |
| const webhookRoutes = require("./webhook"); | |
| require("dotenv").config(); | |
| const app = express(); | |
| app.use(bodyParser.json()); | |
| // Webhook GET route | |
| app.use((req, res, next) => { | |
| if (req.path.substr(-1) === "/" && req.path.length > 1) { | |
| res.redirect(301, req.path.slice(0, -1)); | |
| } else { | |
| next(); | |
| } | |
| }); | |
| // Use the webhook routes | |
| app.use("/webhook", webhookRoutes); | |
| app.get("/test", (req, res) => { | |
| res.send("Test route works!"); | |
| }); | |
| app.get("/", (req, res) => { | |
| res.status(200).send("Home route works!"); | |
| }); | |
| // Start the server | |
| const PORT = process.env.PORT || 3000; | |
| app.listen(PORT, () => { | |
| console.log(`Server running on port ${PORT}`); | |
| }); | |