This project is a simple task management application with a backend in Node.js (TypeScript) and a frontend in React.
The goal of this exercise is to test your skills in creating a TypeScript API in Node.js without any frameworks and a frontend component in React that interacts with this API.
-
Backend (in
/backend):- TypeScript setup for Node.js with routes in
/routes. - Implement two routes:
GET /tasks- Fetches all tasks.POST /tasks- Adds a new task with atitle.
- Store tasks in-memory for this test. Each task should have a unique
idandtitle. - Respond with error code
400iftitleis missing or the JSON is invalid in thePOSTrequest.
- TypeScript setup for Node.js with routes in
-
Frontend (in
/frontend/src/TaskManager.js):- Create a
TaskManagercomponent that displays tasks and allows adding new ones. - Use
fetchto interact with the backend API. - Display a list of all tasks and a form to add a new task.
- Create a
-
Setup Backend
- Navigate to the
backendfolder. - Run
npm installto install dependencies. - Run
npm run devto start the server with TypeScript on port 3000.
- Navigate to the
-
Setup Frontend
- Navigate to the
frontendfolder. - Run
npm installto install dependencies. - Run
npm startto start the frontend server on port 3001.
- Navigate to the
- The backend and frontend should work together; the frontend makes requests to
http://localhost:3000for the backend API. - You are encouraged to document your code for readability and maintainability.
Good luck!