Full Stack Node.js React Advanced (Coding)

 90 Minutes
 4 Questions


Advanced Full-Stack Coding Challenge: This focused coding challenge evaluates candidates on advanced full-stack development, emphasizing proficiency in React's complex functionalities and Node.js with Express's secure backend operations. Candidates will demonstrate expertise in sophisticated React patterns and state management techniques. On the backend, the challenge involves creating robust server solutions using Node.js and Express. This includes advanced route management, JWT authentication practices, secure password hashing, and the strategic use of express-rate-limit for defense against excessive requests. Overall, this challenge directly assesses a candidate's practical skills in handling complex full-stack projects, requiring adept technical prowess and forward-thinking problem-solving in real-world development scenarios.


Example Question:

Coding
Develop an authentication system for an Express.js application.
The requirements are as follows:
User Registration:
  • Endpoint: POST /register
  • Data: username, password, and email.
  • Hash passwords before storing them in an in-memory user store.
User Login:
  • Endpoint: POST /login
  • Data: username and password.
  • Upon successful login, provide the user with a JWT set in a cookie.
User Profile:
  • Endpoint: GET /profile
  • Middleware: Protected by JWT verification.
Admin Access:
  • Endpoint: GET /admin
  • Middleware: Protected by both JWT and role-checking middleware. Only users with the role admin should access this.
Logout:
  • Endpoint: GET /logout
  • Clear the JWT cookie for the logged-in user.



You are expected to use the following libraries to achieve the above requirements:
  • express: For setting up the server and routes.
  • jsonwebtoken: For generating and verifying JSON Web Tokens.
  • bcryptjs: For hashing user passwords.
  • cookie-parser: For parsing cookies from requests.



Please ensure your solution integrates these libraries and endpoints appropriately.