Project Overview: myNoteBook

I’m working on a web application using React for the frontend and Express.js for the backend. The application includes user authentication features such as signup and login. The frontend is responsible for handling user interactions and making API calls to the backend for user-related operations.

Signup Component (Signupp.js):

The Signupp.js component contains a form for users to create a new account. It collects user data including name, email, and password.
Upon form submission, a POST request is made to the backend endpoint /api/auth/createuser using the fetch API.enter image description here
The backend is expected to create a new user in the database and return a success response along with an authentication token.
**
Login Component (Login.js):**

The Login.js component contains a form for users to log in to their accounts. It collects user data including email and password.
Upon form submission, a POST request is made to the backend endpoint /api/auth/login using the fetch API.
The backend is expected to authenticate the user credentials and return a success response along with an authentication token.
Issue with Login after Signup:

After successfully signing up a new user, the user is redirected to the login page (Login.js) to log in to their newly created account.
However, upon entering the correct credentials and submitting the login form, the user is not able to log in and access the notebook functionality.

I’m seeking assistance in resolving the issue of not being able to log in after signing up successfully. Despite entering the correct credentials in the login form, the user is unable to access the notebook functionality. Any insights, suggestions, or code snippets to debug and fix this issue would be greatly appreciated.

C:Usersvijay>cd C:UsersvijayOneDriveDesktopmyNoteBook

C:UsersvijayOneDriveDesktopmyNoteBook>cd backend

C:UsersvijayOneDriveDesktopmyNoteBookbackend>node index.js
(node:20656) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
(Use node --trace-warnings ... to show where the warning was created)
(node:20656) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
App running on port http://localhost:5000
Connected to MongoDB

Welcome to the backend server getting this in the backend

C:Usersvijay>cd C:UsersvijayOneDriveDesktopmyNoteBook

C:UsersvijayOneDriveDesktopmyNoteBook>npm start

[email protected] start
react-scripts start

(node:21148) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: ‘onAfterSetupMiddleware’ option is deprecated. Please use the ‘setupMiddlewares’ option.
(Use node --trace-deprecation ... to show where the warning was created)
(node:21148) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: ‘onBeforeSetupMiddleware’ option is deprecated. Please use the ‘setupMiddlewares’ option.
Starting the development server…
Compiled successfully!

You can now view my-notebook-frontend in the browser.

Local: http://localhost:3000
On Your Network: http://192.168.123.156:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

webpack compiled successfully

I’m working on a web application using React for the frontend, Express.js for the backend, and MongoDB for the database. The application includes user authentication features such as signup and login. Upon signing up, users should be redirected to a notebook page (mynotebook) where they can write and save notes. These notes should be associated with the user’s account and retrieved upon subsequent logins.

**
What I’ve Tried:**

Implemented a Signup component (Signupp.js) that successfully creates a new user in the MongoDB database (myNoteBook) upon form submission.
Created a Login component (Login.js) to authenticate users and redirect them to the notebook page (mynotebook) upon successful login.
Configured the backend API routes (/api/auth/createuser and /api/auth/login) to handle user creation and authentication, respectively.
Stored authentication tokens in local storage upon login for subsequent API requests.

Expected Behavior:

When a user signs up, they should be redirected to the notebook page (mynotebook) automatically.
Upon subsequent logins with the same email, users should be redirected to the notebook page (mynotebook) where they can view and edit their previously saved notes.
Issue Faced:

Despite successful user creation and authentication, I’m unable to redirect users to the notebook page (mynotebook) after signup or login.
Notes written by the user in the notebook are not displayed upon logging in, indicating a potential issue with retrieving and displaying user-specific data.
Request for Assistance:

I’m seeking guidance on how to properly redirect users to the notebook page (mynotebook) upon signup and login.
Additionally, I need assistance in fetching and displaying user-specific notes from MongoDB upon login.

Code Snippets:

Signupp.js: Contains the form and logic for user signup.
Login.js: Contains the form and logic for user login.
Backend API routes (/api/auth/createuser and /api/auth/login): Handle user creation and authentication.
MongoDB Schema for User and Notes: Define the structure of user accounts and associated notes.

New contributor

Vijaya Kumar Annam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật