Skip to content

Commit

Permalink
Middleware Converted (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyumat committed Jan 8, 2023
1 parent 5045247 commit 46f32c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions backend/middleware/tracker.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Router } from "express";
import { Router, Request, Response } from "express";

const router = Router();
const connectionTracker = {};

router.all("*", function (req, res, next) {
router.all("*", function (req: Request, res: Response, next) {
const counter = connectionTracker[req.originalUrl];

if (counter || counter === 0) {
Expand Down
10 changes: 4 additions & 6 deletions backend/utils/setHeaders.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Router } from "express";
import { Router, Request, Response } from "express";
const router = Router();

router.post("/", async (req, res) => {
router.post("/", async (req: Request, res: Response) => {
res.header("Access-Control-Allow-Origin", "*");
res.header(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept"
);
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
});

export default router;

0 comments on commit 46f32c8

Please sign in to comment.