- You have learned almost everything you need to know on how to build a backend application with NodeJS, now it's time to deploy your project to the internet so people can access the endpoints you created.
- Fork and Clone this project repository in your terminal
- CD into the project base directory
cd Week22_Task_Management_DEPLOY - Install dependencies:
npm install
- Create a
.envfile in the root directory with your database URL and JWT secret - Complete the authentication middleware and routes (see tasks below)
- Generate Prisma client and push schema to database:
npm run db:generate npm run db:push
- Start the server:
npm run dev
- The server will run on
http://localhost:3000
In the routes/tasks.js file, you need to add proper HTTP status codes to all the response objects. Currently, all responses are missing status codes and only return JSON data.
Requirements:
- Add appropriate HTTP status codes to all
res.json()calls - Use the correct status codes for different scenarios:
200for successful GET, PUT, DELETE operations201for successful POST operations (resource creation)400for bad requests (validation errors)404for not found errors500for server errors
- Look for the TODO comments in the code that indicate where status codes need to be added
Create comprehensive API documentation in the API_DOC.md file. Include:
- Base URL
- All available endpoints
- Request/response formats
- Authentication requirements
- Error handling
- Example requests and responses
Deploy your Task Management API to Render.com:
- Go to render.com
- Sign up for a free account using your GitHub account
- Verify your email address
- Connect your GitHub repository to Render
- Create a new Web Service
- Choose your repository and branch
- Configure the following settings:
- Build Command:
npm install - Start Command:
npm start - Environment: Node
- Build Command:
In your Render dashboard, add the following environment variables:
DATABASE_URL: Your Supabase database connection URLJWT_SECRET: Your JWT secret keyPORT: 10000 (Render's default port)
Make sure your Supabase database is accessible from Render and run the following commands in your Render build process:
npm run db:generate
npm run db:pushYour API will be available at the URL provided by Render (e.g., https://your-app-name.onrender.com)
Good luck with your implementation! 🚀