From ef942777cbf947d8487072f29d14dc8f6e4f2bc6 Mon Sep 17 00:00:00 2001 From: prathameshpatil5181 Date: Sat, 20 May 2023 01:02:30 +0530 Subject: [PATCH 1/4] completed assignment 3 --- .idea/.gitignore | 5 +++ .idea/modules.xml | 8 ++++ .idea/peetcode.iml | 12 ++++++ .idea/vcs.xml | 6 +++ client/src/Components/Login/Login.jsx | 3 ++ .../Components/ProblemsPage/ProblemsPage.css | 20 +++++++++ .../Components/ProblemsPage/ProblemsPage.jsx | 41 +++++++++++++++++-- client/src/Components/Signup/Signup.jsx | 3 ++ client/src/constants.js | 2 +- server/index.js | 10 ++++- 10 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/peetcode.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..89705fc3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/peetcode.iml b/.idea/peetcode.iml new file mode 100644 index 00000000..24643cc3 --- /dev/null +++ b/.idea/peetcode.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/client/src/Components/Login/Login.jsx b/client/src/Components/Login/Login.jsx index 6cc12bfe..329e6256 100644 --- a/client/src/Components/Login/Login.jsx +++ b/client/src/Components/Login/Login.jsx @@ -27,6 +27,9 @@ const Login = () => { @@ -79,7 +112,7 @@ const ProblemsPage = () => { } - + ) } diff --git a/client/src/Components/Signup/Signup.jsx b/client/src/Components/Signup/Signup.jsx index 20ca0cfb..40db8a09 100644 --- a/client/src/Components/Signup/Signup.jsx +++ b/client/src/Components/Signup/Signup.jsx @@ -38,6 +38,9 @@ const Signup = () => { onClick={async (e) => { const response = await fetch(`${backendUrl}/signup`, { method: "POST", + headers:{ + 'Content-Type':'application/json' + }, body: JSON.stringify({ email: email, password: password, diff --git a/client/src/constants.js b/client/src/constants.js index 2a84056f..00a9de8d 100644 --- a/client/src/constants.js +++ b/client/src/constants.js @@ -1 +1 @@ -export const backendUrl = "https://api.peetcode.com"; +export const backendUrl = "http://localhost:3000"; diff --git a/server/index.js b/server/index.js index 9691a837..b3c948b1 100644 --- a/server/index.js +++ b/server/index.js @@ -10,7 +10,9 @@ const bodyParser = require("body-parser"); var jsonParser = bodyParser.json(); var urlencodedParser = bodyParser.urlencoded({ extended: false }); const cors = require("cors"); -app.use(cors()); +app.use(cors( + {origin: "*"} +)); app.use(jsonParser); const PROBLEMS = [ @@ -211,6 +213,12 @@ app.post("/login", (req, res) => { return res.json({ token }); }); +app.get("/all",(req,res)=>{ + return res.json({ + user:USERS + }) +}) + app.listen(port, () => { console.log(`Example app listening on port ${port}`); }); From 3952ba8334351724ba81ab5175f32f07303446e6 Mon Sep 17 00:00:00 2001 From: prathameshpatil5181 Date: Sat, 20 May 2023 01:05:54 +0530 Subject: [PATCH 2/4] completed assignment 3 --- server/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/server/index.js b/server/index.js index b3c948b1..62ef04c9 100644 --- a/server/index.js +++ b/server/index.js @@ -213,12 +213,6 @@ app.post("/login", (req, res) => { return res.json({ token }); }); -app.get("/all",(req,res)=>{ - return res.json({ - user:USERS - }) -}) - app.listen(port, () => { console.log(`Example app listening on port ${port}`); }); From c88999505967dcc4a3175341e7ec96ce28b23db9 Mon Sep 17 00:00:00 2001 From: prathameshpatil5181 Date: Sat, 20 May 2023 01:12:31 +0530 Subject: [PATCH 3/4] completed assignment 3 --- client/src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/constants.js b/client/src/constants.js index 00a9de8d..2a84056f 100644 --- a/client/src/constants.js +++ b/client/src/constants.js @@ -1 +1 @@ -export const backendUrl = "http://localhost:3000"; +export const backendUrl = "https://api.peetcode.com"; From 85d99691a0bd7f7e83d3ae1048a0e2513e646508 Mon Sep 17 00:00:00 2001 From: prathameshpatil5181 Date: Sat, 20 May 2023 01:20:24 +0530 Subject: [PATCH 4/4] completed assignment --- client/src/Components/AllProblems/AllProblems.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/Components/AllProblems/AllProblems.jsx b/client/src/Components/AllProblems/AllProblems.jsx index 1e16e6b2..a4b180e9 100644 --- a/client/src/Components/AllProblems/AllProblems.jsx +++ b/client/src/Components/AllProblems/AllProblems.jsx @@ -32,7 +32,7 @@ const AllProblemsPage = () => { {problems.map((prob,index) => ( - + {prob.title}