From 8e83b6b8df2fd50720146d6cb40c56ca2136a37b Mon Sep 17 00:00:00 2001 From: Malak Date: Sun, 18 Aug 2024 14:43:18 +0300 Subject: [PATCH] Switched to local MongoDB --- .gitignore | 1 + client/src/App2.css | 19 ++++++++++++++----- client/src/TODO.txt | 6 ++++++ client/src/index.tsx | 1 + middleware/auth.ts | 1 - package-lock.json | 12 ++++++------ routers/api/auth.ts | 1 - server.ts | 25 ++++++++++++------------- 8 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 client/src/TODO.txt mode change 100755 => 100644 server.ts diff --git a/.gitignore b/.gitignore index 3c3629e..6b223e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +App.css diff --git a/client/src/App2.css b/client/src/App2.css index b5ac624..1a29d6a 100644 --- a/client/src/App2.css +++ b/client/src/App2.css @@ -1,7 +1,16 @@ -a { - text-decoration: none; - color: darkorange; +.datePicker :hover { + border-color: "#212121"; } -body { - background-color: whitesmoke; +.datePicker :focus { + border-color: "#1976d2"; + border-width: "2px"; +} +.datePicker{ + color:"red"; + background:"red"; +} + +.colormebaby{ + background-color:"red"; + color:"red" } diff --git a/client/src/TODO.txt b/client/src/TODO.txt new file mode 100644 index 0000000..deaad65 --- /dev/null +++ b/client/src/TODO.txt @@ -0,0 +1,6 @@ +1. When creating profile in the Profile form need to be added validation for the +email because if the email is not email it gets sent to the server and crashes +Fix all the form data apis, formData +Extract the inpudate component from addeducation +maybe fix that addeducation + diff --git a/client/src/index.tsx b/client/src/index.tsx index 46075e1..657c6fc 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -2,6 +2,7 @@ import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; +import "./App2.css"; const root = ReactDOM.createRoot( document.getElementById("root") as HTMLElement, ); diff --git a/middleware/auth.ts b/middleware/auth.ts index 82c5b53..e0cab3e 100755 --- a/middleware/auth.ts +++ b/middleware/auth.ts @@ -13,7 +13,6 @@ function auth(req: ResponseAndUser, res: Response, next: NextFunction) { return res.status(401).json({ msg: 'No token, authorization denied' }); } - console.log('auth middlewarwe') // Verify token try { jwt.verify(token, config.get('jwtSecret'), (error, decoded) => { diff --git a/package-lock.json b/package-lock.json index db97fb8..78d0d47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1011,9 +1011,9 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", "dependencies": { "has": "^1.0.3" }, @@ -2902,9 +2902,9 @@ } }, "is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", "requires": { "has": "^1.0.3" } diff --git a/routers/api/auth.ts b/routers/api/auth.ts index cdb8d55..dda785b 100755 --- a/routers/api/auth.ts +++ b/routers/api/auth.ts @@ -17,7 +17,6 @@ const router = express.Router(); router.get("/", auth, async (req: any, res) => { try { let user: unknown = null - console.log(req.user) if (isUserId(req)) { user = await User.findById(req.user.id).select("-password"); res.json(user); diff --git a/server.ts b/server.ts old mode 100755 new mode 100644 index 2de8570..538693b --- a/server.ts +++ b/server.ts @@ -1,26 +1,25 @@ -import express from 'express' +import express from "express"; -import connectDB from './config/db' +import connectDB from "./config/db"; -import path from 'path' +import path from "path"; const app = express(); connectDB(); app.use(express.json()); - -app.use('/api/users', require('./routers/api/users')) -app.use('/api/auth', require('./routers/api/auth')) -app.use('/api/profile', require('./routers/api/profile')) -app.use('/api/posts', require('./routers/api/posts')) +app.use("/api/users", require("./routers/api/users")); +app.use("/api/auth", require("./routers/api/auth")); +app.use("/api/profile", require("./routers/api/profile")); +app.use("/api/posts", require("./routers/api/posts")); // Serve static assets in production -if (process.env.NODE_ENV === 'production') { - app.use(express.static('client/build')); - app.get('*', (req, res) => [ - res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html')) - ]) +if (process.env.NODE_ENV === "production") { + app.use(express.static("client/build")); + app.get("*", (req, res) => [ + res.sendFile(path.resolve(__dirname, "client", "build", "index.html")), + ]); } const PORT = process.env.PORT || 5000;