Skip to content

Commit 05cd51c

Browse files
committed
nono is a bad dev :)
1 parent 9548033 commit 05cd51c

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

web/src/apiRouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ apiRouter.post("/sesame", async (request: Request, response: Response) => {
6868
apiRouter.get("/ping", async (request: Request, response: Response) => {
6969
const interval: number = Number(request.body.interval) || undefined;
7070
setLastTimeChestWasAlive(Date.now(), interval);
71-
logger.info("Chest pinged");
71+
logger.info(`Chest pinged. Next ping in ${interval}`);
7272
return response.status(200).send("Good news ! (Me too)");
7373
});
7474

web/src/app.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ import compression from "compression";
1111
dotenv.config();
1212
const app = express();
1313

14+
// Rate limit
15+
app.use(rateLimit({
16+
windowMs: 10 * 1000, // 10 seconds
17+
max: 15, // limit each IP to 15 requests per windowMs
18+
standardHeaders: 'draft-7',
19+
}));
20+
1421
if (process.env.SENTRY_DSN) {
1522
// Initiate Sentry
1623
Sentry.init({
@@ -25,9 +32,6 @@ if (process.env.SENTRY_DSN) {
2532
}
2633
app.engine('html', ejs.renderFile);
2734

28-
// Enable morgan logger
29-
// app.use(morgan());
30-
3135
// Enable compression
3236
app.use(compression());
3337

@@ -42,17 +46,4 @@ app.use(urlencoded({ extended: true }));
4246
app.use(process.env.API_PREFIX, apiRouter);
4347
app.use("", webRouter);
4448

45-
// Rate limit
46-
app.use(rateLimit({
47-
windowMs: 10 * 1000, // 10 seconds
48-
max: 15, // limit each IP to 15 requests per windowMs
49-
standardHeaders: 'draft-7',
50-
}));
51-
52-
// Not found
53-
// app.use((request: Request, response: Response) => notFound(response, Error.RouteNotFound));
54-
55-
// Error Handles
56-
// app.use(errorHandler);
57-
5849
export default app;

0 commit comments

Comments
 (0)