Spaces:
Build error
Build error
File size: 525 Bytes
2e22a88 b865405 2e22a88 b865405 2e22a88 b865405 2e22a88 b865405 2e22a88 |
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 |
import * as express from "express";
const app = express();
// parse HTTP request bodies as json
app.use(express.json());
app.get("/", (req, res) => {
res.json({ hello: "world" });
});
app.post("/", (req, res) => {
if (req.header("X-Webhook-Secret") !== process.env.WEBHOOK_SECRET) {
return res.status(400).json({ error: "incorrect secret" });
}
console.log(req.body);
res.json({ success: true });
});
const PORT = 7860;
app.listen(PORT, () => {
console.debug(`server started at http://localhost:${PORT}`);
});
|