{"id":23402986,"url":"https://github.com/bikram-gyawali/todo-task-interview","last_synced_at":"2026-04-11T12:03:00.352Z","repository":{"id":268936275,"uuid":"905910171","full_name":"Bikram-Gyawali/todo-task-interview","owner":"Bikram-Gyawali","description":"This is todo task for interview","archived":false,"fork":false,"pushed_at":"2024-12-19T19:37:25.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-19T20:23:55.309Z","etag":null,"topics":["backend","ejs","express","mongodb","nodejs","render","task","todo","todolist"],"latest_commit_sha":null,"homepage":"https://todo-task-interview.onrender.com/todos","language":"EJS","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/Bikram-Gyawali.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-12-19T19:11:40.000Z","updated_at":"2024-12-19T19:37:29.000Z","dependencies_parsed_at":"2024-12-19T20:34:06.506Z","dependency_job_id":null,"html_url":"https://github.com/Bikram-Gyawali/todo-task-interview","commit_stats":null,"previous_names":["bikram-gyawali/todo-task-interview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bikram-Gyawali%2Ftodo-task-interview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bikram-Gyawali%2Ftodo-task-interview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bikram-Gyawali%2Ftodo-task-interview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bikram-Gyawali%2Ftodo-task-interview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bikram-Gyawali","download_url":"https://codeload.github.com/Bikram-Gyawali/todo-task-interview/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238882370,"owners_count":19546496,"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":["backend","ejs","express","mongodb","nodejs","render","task","todo","todolist"],"created_at":"2024-12-22T12:38:21.151Z","updated_at":"2025-10-17T21:22:39.132Z","avatar_url":"https://github.com/Bikram-Gyawali.png","language":"EJS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Todo task API Documentation\n\n## Overview of the service\nIt consist of features like creating todos,updating,filtering , deleting etc\n\n## SETUP PROJECT: \n#\n- git clone \n- `npm install`\n- create .env file at root folder and add the details from template (.env.example)\n- `npm run build \u0026\u0026 npm run start`\n\n# OR directly visit here to test the implementations : \nhttps://todo-task-interview.onrender.com/todos\n\n## Base URL\n```\nhttp://localhost:3000/todos\n```\n\n## Endpoints\n\n### List Todos\nRetrieves a list of todos with optional filtering.\n\n- **URL**: `/`\n- **Method**: `GET`\n- **Query Parameters**:\n  - `filter` (optional): \n    - `all`: All todos (default)\n    - `done`: Completed todos\n    - `upcoming`: todos with date time greater than current day/date\n- **Success Response**:\n  - **Code**: 200\n  - **Content**: redirects to page with list of todos and add todo forms\n- **Error Response**:\n  - **Code**: 400\n  - **Response**: `{ \"success\": false, \"message\": \"Error listing Todos\" }`\n- **Sample Request**:\n  ```\n  GET /todos?filter=upcoming\n  ```\n\n### Create Todo\nCreates a new todo item.\n\n- **URL**: `/`\n- **Method**: `POST`\n- **Content-Type**: `application/json`\n- **Request Body**:\n  ```json\n  {\n    \"name\": \"Complete project\",\n    \"description\": \"Finish the todo API implementation\",\n    \"date\": \"2024-12-25T10:00:00\",\n    \"isDone\": false\n  }\n  ```\n- **Required Fields**:\n  - `name` (string): 3-50 characters\n  - `description` (string): 5-200 characters\n  - `date` (ISO date string)\n- **Optional Fields**:\n  - `isDone` (boolean): defaults to false\n- **Success Response**:\n  - **Code**: 201\n  - **Content**: Created todo object\n- **Error Response**:\n  - **Code**: 400\n  - **Content**: \n    ```jsn\n    {\n      \"success\": false,\n      \"message\": \"Validation Error\",\n      \"details\": [\"Name must be between 3 and 50 characters\"]\n    }\n    ```\n\n### Update Todo\nUpdates an existing todo item.\n\n- **URL**: `/:id`\n- **Method**: `PUT`\n- **URL Parameters**: \n  - `id`: Todo ID\n- **Request Body**: Same as Create Todo\n- **Success Response**:\n  - **Code**: 200\n  - **Content**: Updated todo object\n- **Error Response**:\n  - **Code**: 404\n  - **Content**: `{ \"success\": false, \"message\": \"Todo not found\" }`\n\n### Toggle Todo Status\nToggles the completion status of a todo.\n\n- **URL**: `/:id/toggle`\n- **Method**: `PUT`\n- **URL Parameters**:\n  - `id`: Todo ID\n- **Success Response**:\n  - **Code**: 200\n  - **Content**: Updated todo object\n- **Error Response**:\n  - **Code**: 404\n  - **Content**: `{ \"success\": false, \"message\": \"Todo not found\" }`\n\n### Delete Todo\nDeletes a todo item.\n\n- **URL**: `/:id`\n- **Method**: `DELETE`\n- **URL Parameters**:\n  - `id`: Todo ID\n- **Success Response**:\n  - **Code**: 200\n  - **Content**: `{ \"success\": true, \"message\": \"Todo deleted successfully\" }`\n- **Error Response**:\n  - **Code**: 404\n  - **Content**: `{ \"success\": false, \"message\": \"Todo not found\" }`\n\n## Data Models\n\n### Todo Schema\n```typescript\n{\n  name: {\n    type: String,\n    required: true,\n    minLength: 3,\n    maxLength: 50\n  },\n  description: {\n    type: String,\n    required: true,\n    minLength: 5,\n    maxLength: 200\n  },\n  date: {\n    type: Date,\n    required: true\n  },\n  isDone: {\n    type: Boolean,\n    default: false\n  }\n}\n```\n\n## Error Handling\n\nAll endpoints return errors in the following format:\n```json\n{\n  \"success\": false,\n  \"message\": \"Error message here\",\n  \"details\": [\"Optional array of specific error details\"]\n}\n```\n\nCommon error codes:\n- `400`: Bad Request (validation errors)\n- `404`: Not Found\n- `500`: Internal Server Error\n\n## Frontend Integration\n\n### AJAX Requests\nWhen making AJAX requests, include the header:\n```javascript\nheaders: {\n  'X-Requested-With': 'XMLHttpRequest'\n}\n```\n\n### Form Validation Rules\n- Name: 3-50 characters\n- Description: 5-200 characters\n- Date: Valid ISO date string\n- isDone: Boolean (optional)\n\n## Examples\n\n### Create Todo Request\n```javascript\nfetch('/todos', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Requested-With': 'XMLHttpRequest'\n  },\n  body: JSON.stringify({\n    name: \"Team meeting\",\n    description: \"Weekly sync with the development team\",\n    date: \"2024-12-21T14:00:00\"\n  })\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbikram-gyawali%2Ftodo-task-interview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbikram-gyawali%2Ftodo-task-interview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbikram-gyawali%2Ftodo-task-interview/lists"}