The base URL for the API is: http://localhost:3001/ when running locally, and will be different in the production environment depending on your deployment.
- POST
/api/users/- Description: Register a new user in the system.
- Body:
{ "username": "string", "email": "string", "password": "string" } - Responses:
200 OKon success with the user object.400 Bad Requestif there's an error.
- POST
/api/users/login- Description: Authenticate a user and start a session.
- Body:
{ "email": "string", "password": "string" } - Responses:
200 OKon success with a welcome message.400 Bad Requestif credentials are incorrect.
- POST
/api/users/logout- Description: Log out the current user and destroy the session.
- Responses:
204 No Contenton success.404 Not Foundif no session is found.
- POST
/api/projects/- Description: Create a new project, user must be authenticated.
- Body:
{ "name": "string", "description": "string", "user_id": "integer" } - Responses:
200 OKon success with the project object.400 Bad Requestif there's an error.
- DELETE
/api/projects/:id- Description: Delete a project by its ID, user must be authenticated and must be the owner of the project.
- URL Parameters:
idof the project to delete. - Responses:
200 OKon success.404 Not Foundif the project does not exist.500 Internal Server Errorif there's an error.
- GET
/- Description: Retrieve the homepage with all projects.
- Responses:
200 OKand renders thehomepageview with projects data.500 Internal Server Errorif there's an error.
- GET
/project/:id- Description: Retrieve details for a single project.
- URL Parameters:
idof the project. - Responses:
200 OKand renders theprojectview with project data.500 Internal Server Errorif there's an error.
- GET
/profile- Description: Retrieve the profile page for the logged-in user, must be authenticated.
- Responses:
200 OKand renders theprofileview with user data.500 Internal Server Errorif there's an error.
- GET
/login- Description: Retrieve the login page.
- Responses:
200 OKand renders theloginview.- Redirects to
/profileif the user is already logged in.
Note: All POST requests that create or modify data should be protected with authentication middleware, ensuring that only authenticated users can perform those operations.
Please ensure that you replace the base URL with your production URL when deploying the application. This documentation should be updated as new endpoints are added or changes are made to existing ones