summaryrefslogtreecommitdiffstats
path: root/backend/index.ts
blob: b57cb4ddde262472cdc85d84cf349f01aa9dc925 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import express from "express";

const app = express();
const PORT = 8001;

app.use(express.json());
app.use("/", express.static("../dist"));

const longpoll = require("express-longpoll")(app);
longpoll.create("/poll");

app.post("/send", (req, res) => {
  longpoll.publish("/poll", req.body)
  res.send("OK");
});

app.listen(PORT, () => {
  console.log(`[server]: Server is running at https://localhost:${PORT}`);
});