diff options
| author | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-26 08:38:37 +0200 |
|---|---|---|
| committer | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-26 08:38:37 +0200 |
| commit | 28497b06e208cd8fd4aa94756c7a5626c18d9878 (patch) | |
| tree | 1b44a0f30c7844ed2069a4b5bb06f2925e2b964e /backend/index.ts | |
| parent | c7b3012c7aba9cdbe90932c9d37057f26b3a1e33 (diff) | |
| download | IRC-28497b06e208cd8fd4aa94756c7a5626c18d9878.tar.gz IRC-28497b06e208cd8fd4aa94756c7a5626c18d9878.tar.zst IRC-28497b06e208cd8fd4aa94756c7a5626c18d9878.zip | |
Added all features
Diffstat (limited to 'backend/index.ts')
| -rw-r--r-- | backend/index.ts | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/backend/index.ts b/backend/index.ts index 140e7b9..724be05 100644 --- a/backend/index.ts +++ b/backend/index.ts @@ -1,36 +1,27 @@ import express from "express"; import cors from "cors"; -import * as dotenv from "dotenv"; -// import abc from "./modules/dummy"; -// abc(); - -// const global = { stop: false }; - -dotenv.config(); const app = express(); const PORT = 5000; - app.use(express.json()); app.use(cors()); app.use("/", express.static("../dist")); const longpoll = require("express-longpoll")(app); longpoll.create("/poll", cors()); -var data = { text: "Some data" }; app.post("/send", (req, res) => { - console.log(JSON.stringify(req)); - longpoll.publish("/poll", req.body) - res.send("OK"); + console.log(req.body); + longpoll.publish("/poll", req.body) + res.send("OK"); }); app.listen(PORT, () => { console.log(`[server]: Server is running at https://localhost:${PORT}`); }); -// longpoll.publish("/poll", data); -setInterval(function () { - longpoll.publish("/poll", data); -}, 1000);
\ No newline at end of file +// const data: Message = { text: "Some data", color: "#654321", username: "maks" }; +// setInterval(function () { +// longpoll.publish("/poll", data); +// }, 5000);
\ No newline at end of file |
