Skip to content

Commit

Permalink
middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
EslamAsHhraf committed Dec 23, 2022
1 parent acd9bb4 commit 1c238d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions data/Subreddit.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"topics": [],
"primaryTopic": "Add a Primary Topic",
"owner": "638b8c62c20658257a3c450a",
"moderators": {
"user": [{
"moderators":
[{"user": {
"id": "638b8c62c20658257a3c450a",
"userName": "nourr",
"joiningDate": 1670104113541,
Expand All @@ -57,8 +57,8 @@
"flair": true,
"posts": true
}
}]
},
}}
],
"flairIds": []
}
}
7 changes: 7 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// middleware.ts
module.exports = (req, res, next) => {
if (req.method !== 'GET') {
req.method = 'GET';
}
next();
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!axios)/\" ",
"eject": "react-scripts eject",
"docs": "jsdoc -c jsdoc.json",
"server-json": "json-server --watch data/index.js --port 8000 --routes data/routes.json"
"server-json": "json-server --watch data/index.js --port 8000 --routes data/routes.json --middlewares middleware.ts"
},
"eslintConfig": {
"extends": [
Expand Down

0 comments on commit 1c238d9

Please sign in to comment.