{"id":15889197,"url":"https://github.com/srikanth-kandi/epimax-backend","last_synced_at":"2026-05-09T00:32:29.374Z","repository":{"id":237268226,"uuid":"794168441","full_name":"srikanth-kandi/epimax-backend","owner":"srikanth-kandi","description":"EpiMax Tasks API","archived":false,"fork":false,"pushed_at":"2024-05-02T11:35:16.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T07:28:00.340Z","etag":null,"topics":["api","expressjs","rest-api"],"latest_commit_sha":null,"homepage":"https://epimax-backend-3j21.onrender.com/docs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srikanth-kandi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-30T15:29:24.000Z","updated_at":"2024-05-02T11:35:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"9316ef9f-de41-4183-949c-790acbd1affd","html_url":"https://github.com/srikanth-kandi/epimax-backend","commit_stats":null,"previous_names":["srikanth-kandi/epimax-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanth-kandi%2Fepimax-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanth-kandi%2Fepimax-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanth-kandi%2Fepimax-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanth-kandi%2Fepimax-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srikanth-kandi","download_url":"https://codeload.github.com/srikanth-kandi/epimax-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246854839,"owners_count":20844828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","expressjs","rest-api"],"created_at":"2024-10-06T06:41:39.591Z","updated_at":"2026-05-09T00:32:29.343Z","avatar_url":"https://github.com/srikanth-kandi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EpiMax Tasks API\n\nLive API URL - [https://epimax-backend-3j21.onrender.com/docs](https://epimax-backend-3j21.onrender.com/docs)\n\n⚠️ Since the API is currently deployed on the **Free Web Service** of [Render](https://render.com), sometimes the server may be in sleep mode. If you encounter any issues, please try after some time. Thank you!\n\n\u003e Your free instance will spin down with inactivity, which can delay requests by 50 seconds or more.\n\n### Database Schema\n\n```sql\n-- PostgreSQL schema creation for users table\nCREATE TABLE users (\n    id SERIAL PRIMARY KEY,\n    username TEXT NOT NULL UNIQUE,\n    password_hash TEXT NOT NULL\n);\n\n-- PostgreSQL schema creation for tasks table\nCREATE TABLE tasks (\n    id SERIAL PRIMARY KEY,\n    title TEXT NOT NULL,\n    description TEXT NOT NULL,\n    status TEXT NOT NULL,\n    assignee_id INTEGER NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY(assignee_id) REFERENCES users(id)\n);\n```\n\n### Instructions to run the application\n\n1. Clone the repository\n2. Run `npm install` to install the dependencies\n3. Create a `.env` file in the root directory and add the following environment variables\n\n    ```\n    DB_USER=your_db_username\n    DB_PASSWORD=your_db_password\n    DB_NAME=your_db_name\n    DB_HOST=your_db_host\n    JWT_SECRET=your_secret\n    DB_PORT=5432\n    DB_CA=your_db_ca\n    ```\n4. Run `npm start` to start the server\n5. The server will start running on `http://localhost:3000`\n\n### Existing User entries in users table\n\n```json\n{\n    \"username\": \"srikanth\",\n    \"password\": \"sri_pass\"\n}\n```\n\n```json\n{\n    \"username\": \"testuser\",\n    \"password\": \"test@123\"\n}\n```\n\n### Existing Tasks entries in tasks table\n\nTasks created by `srikanth`\n\n```json\n{\n    \"title\": \"do the EpiMax Backend Assignment\",\n    \"description\": \"using the ExpressJS and Deploy online\",\n    \"status\": \"done\"\n}\n```\n\n```json\n{\n    \"title\": \"Resolve pending issues on GitHub\",\n    \"description\": \"For te.react.dev and travel-diary-backend\",\n    \"status\": \"to do\"\n}\n```\n\nTasks created by `testuser`\n\n```json\n{\n    \"title\": \"test task title\",\n    \"description\": \"test task description\",\n    \"status\": \"in progress\"\n}\n```\n\n### API Endpoints\n\n1. **User Registration**\n\n    - Endpoint: `/register`\n    - Method: `POST`\n    - Request Body:\n        The `\"username\"` must be unique.\n\n        ```json\n        {\n            \"username\": \"example\",\n            \"password\": \"example_password\"\n        }\n        ```\n    - Response:\n        - Status Code: `201`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"User created successfully\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the `\"username\"` or `\"password\"` is missing or `null`.\n\n            ```json\n            {\n                \"message\": \"username and password are required\"\n            }\n            ```\n        - Status Code: `400`\n        - Response Body:\n        If the user with the same username already exists.\n\n            ```json\n            {\n                \"message\": \"User with this username already exists\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\n2. **User Login**\n\n    - Endpoint: `/login`\n    - Method: `POST`\n    - Request Body:\n        The `\"username\"` must be registered and the `\"password\"` must be correct.\n\n        ```json\n        {\n            \"username\": \"example\",\n            \"password\": \"example_password\"\n        }\n        ```\n    - Response:\n        - Status Code: `200`\n        - Response Body:\n        Returns a token which is required to access the `Tasks` endpoints and is valid for 24 hours.\n\n            ```json\n            {\n                \"token\": \"YOUR_JWT_TOKEN\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the `\"username\"` or `\"password\"` is missing or `null`.\n\n            ```json\n            {\n                \"message\": \"username and password are required\"\n            }\n            ```\n        - Status Code: `404`\n        - Response Body:\n        If the user with the given username is not found.\n\n            ```json\n            {\n                \"message\": \"User with this username does not exist\"\n            }\n            ```\n        - Status Code: `401`\n        - Response Body:\n        If the password is incorrect.\n\n            ```json\n            {\n                \"message\": \"Invalid password\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\nBefore proceeding to below endpoints the token received from the `/login` endpoint must be added to the request headers as `Authorization: Bearer TOKEN_RECEIVED_FROM_LOGIN_ENDPOINT`. Falied to provide the token will result in below response from the server.\n\n```json\n{\n    \"message\": \"Authorization failed\"\n}\n```\n\n3. **Create Task**\n\n    - Endpoint: `/tasks`\n    - Method: `POST`\n    - Request Body:\n\n        ```json\n        {\n            \"title\": \"Task title\",\n            \"description\": \"Task description\",\n            \"status\": \"to do\"\n        }\n        ```\n    - Response:\n        - Status Code: `201`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Task created successfully\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the `\"title\"`, `\"description\"`, or `\"status\"` is missing or `null`.\n\n            ```json\n            {\n                \"message\": \"title, description and status are required\"\n            }\n            ```\n        - Status Code: `422`\n        - Response Body:\n        If the status is invalid.\n\n            ```json\n            {\n                \"message\": \"Invalid status, status must be 'to do' or 'in progress' or 'done'\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\n4. **Get All Tasks**\n\n    - Endpoint: `/tasks`\n    - Method: `GET`\n    - Response:\n        - Status Code: `200`\n        - Response Body:\n        Returns all tasks created by the logged in user.\n\n            ```json\n            [\n                {\n                    \"id\": 1,\n                    \"title\": \"Task title\",\n                    \"description\": \"Task description\",\n                    \"status\": \"to do\"\n                },\n                {\n                    \"id\": 2,\n                    \"title\": \"Another Task\",\n                    \"description\": \"Another Task description\",\n                    \"status\": \"in progress\"\n                }\n            ]\n            ```\n    - Error Response:\n        - Status Code: `404`\n        - Response Body:\n        If there are no tasks created by the user.\n\n            ```json\n            {\n                \"message\": \"No tasks found for this user\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\n5. **Get Task by ID**\n\n    - Endpoint: `/tasks/:taskId`\n    - Method: `GET`\n    - Response:\n        - Status Code: `200`\n        - Response Body:\n\n            ```json\n\n\n            {\n                \"id\": 1,\n                \"title\": \"Task title\",\n                \"description\": \"Task description\",\n                \"status\": \"to do\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the task ID is not a valid number.\n\n            ```json\n            {\n                \"message\": \"Task id must be a positive number\"\n            }\n            ```\n        - Status Code: `404`\n        - Response Body:\n        If the task with the given ID is not found.\n\n            ```json\n            {\n                \"message\": \"Task not found for this id\"\n            }\n            ```\n        - Status Code: `403`\n        - Response Body:\n        If the task does not belong to the logged in user.\n\n            ```json\n            {\n                \"message\": \"You are not authorized to view this task\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\n6. **Update Task**\n\n    - Endpoint: `/tasks/:taskId`\n    - Method: `PUT`\n    - Request Body:\n\n        ```json\n        {\n            \"title\": \"Updated Task title\",\n            \"description\": \"Updated Task description\",\n            \"status\": \"done\"\n        }\n        ```\n    - Response:\n        - Status Code: `200`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Task updated successfully\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the task ID is not a valid number.\n\n            ```json\n            {\n                \"message\": \"Task id must be a positive number\"\n            }\n            ```\n        - Status Code: `422`\n        - Response Body:\n        If the `\"status\"` is invalid.\n\n            ```json\n            {\n                \"message\": \"Invalid status, status must be 'to do' or 'in progress' or 'done'\"\n            }\n            ```\n        - Status Code: `404`\n        - Response Body:\n        If the task with the given ID is not found.\n\n            ```json\n            {\n                \"message\": \"Task not found for this id\"\n            }\n            ```\n        - Status Code: `403`\n        - Response Body:\n        If the task does not belong to the logged in user.\n\n            ```json\n            {\n                \"message\": \"You are not authorized to update this task\"\n            }\n            ```\n        - Status Code: `409`\n        - Response Body:\n        If there is no data provided to update.\n\n            ```json\n            {\n                \"message\": \"At least one parameter (title, description, status) must be provided\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n\n7. **Delete Task**\n\n    - Endpoint: `/tasks/:taskId`\n    - Method: `DELETE`\n    - Response:\n        - Status Code: `200`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Task deleted successfully\"\n            }\n            ```\n    - Error Response:\n        - Status Code: `400`\n        - Response Body:\n        If the task ID is not a valid number.\n\n            ```json\n            {\n                \"message\": \"Task id must be a positive number\"\n            }\n            ```\n        - Status Code: `404`\n        - Response Body:\n        If the task with the given ID is not found.\n\n            ```json\n            {\n                \"message\": \"Task not found for this id\"\n            }\n            ```\n        - Status Code: `403`\n        - Response Body:\n        If the task does not belong to the logged in user.\n\n            ```json\n            {\n                \"message\": \"You are not authorized to delete this task\"\n            }\n            ```\n        - Status Code: `500`\n        - Response Body:\n\n            ```json\n            {\n                \"message\": \"Internal server error\"\n            }\n            ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrikanth-kandi%2Fepimax-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrikanth-kandi%2Fepimax-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrikanth-kandi%2Fepimax-backend/lists"}