-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Elijah Bodden <[email protected]>
- Loading branch information
1 parent
c233374
commit 5745d81
Showing
1 changed file
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
5a6 | ||
> const express = require("express"); | ||
< const express = require("express"); | ||
6a8 | ||
> const path = require("path"); | ||
< const path = require("path"); | ||
8a11,12 | ||
> const helmet = require("helmet"); | ||
> const rateLimit = require("express-rate-limit"); | ||
< const helmet = require("helmet"); | ||
< const rateLimit = require("express-rate-limit"); | ||
50a55,61 | ||
> const rateLimiter = rateLimit({ | ||
> max: 1000, | ||
> windowMs: 360000, | ||
> message: | ||
> "RateLimiterRejection: more than 1000 requests made from this IP in the last hour", | ||
> }); | ||
> | ||
< const rateLimiter = rateLimit({ | ||
< max: 1000, | ||
< windowMs: 360000, | ||
< message: | ||
< "RateLimiterRejection: more than 1000 requests made from this IP in the last hour", | ||
< }); | ||
< | ||
52a64,74 | ||
> const expressFrontend = express(); | ||
> const ROOT = path.join(__dirname, "../frontend/dist"); | ||
> expressFrontend.use(express.static(ROOT)); | ||
> expressFrontend.use(helmet()); | ||
> expressFrontend.use(rateLimiter); | ||
> expressFrontend.get("/", async function (req, res) { | ||
> res.sendFile(ROOT); | ||
> }); | ||
> expressFrontend.get("*", async function (req, res) { | ||
> res.redirect("/"); | ||
> }); | ||
< const expressFrontend = express(); | ||
< const ROOT = path.join(__dirname, "../frontend/dist"); | ||
< expressFrontend.use(express.static(ROOT)); | ||
< expressFrontend.use(helmet()); | ||
< expressFrontend.use(rateLimiter); | ||
< expressFrontend.get("/", async function (req, res) { | ||
< res.sendFile(ROOT); | ||
< }); | ||
< expressFrontend.get("*", async function (req, res) { | ||
< res.redirect("/"); | ||
< }); | ||
186c208,209 | ||
< websocketServer.listen(8192); | ||
> websocketServer.listen(8192); | ||
--- | ||
> websocketServer.listen(8777); | ||
> expressFrontend.listen(8000); | ||
411d433 | ||
< | ||
< websocketServer.listen(8777); | ||
< expressFrontend.listen(8000); | ||
411d433 |