{"id":26497608,"url":"https://github.com/emilioddev/taskjs","last_synced_at":"2026-04-08T18:01:37.859Z","repository":{"id":251241155,"uuid":"836817763","full_name":"EmiliodDev/TaskJS","owner":"EmiliodDev","description":"RESTful API built with Express.js and Node.js that allows users to register accounts, log in, and manage personal tasks.","archived":false,"fork":false,"pushed_at":"2024-08-01T17:07:08.000Z","size":8608,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T13:44:21.812Z","etag":null,"topics":["api","expressjs","js","json","jwt-authentication","mongodb","nodejs","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EmiliodDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-01T16:09:20.000Z","updated_at":"2024-08-01T17:19:08.000Z","dependencies_parsed_at":"2024-08-01T18:38:19.127Z","dependency_job_id":null,"html_url":"https://github.com/EmiliodDev/TaskJS","commit_stats":null,"previous_names":["emilioddev/taskjs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EmiliodDev/TaskJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmiliodDev%2FTaskJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmiliodDev%2FTaskJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmiliodDev%2FTaskJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmiliodDev%2FTaskJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmiliodDev","download_url":"https://codeload.github.com/EmiliodDev/TaskJS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmiliodDev%2FTaskJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31567227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","js","json","jwt-authentication","mongodb","nodejs","rest-api"],"created_at":"2025-03-20T13:43:18.899Z","updated_at":"2026-04-08T18:01:37.819Z","avatar_url":"https://github.com/EmiliodDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TaskJS\n\n![Express.js](https://img.shields.io/badge/Express.js-4.x-blue) ![Node.js](https://img.shields.io/badge/Node.js-20.x-green) ![MongoDB](https://img.shields.io/badge/MongoDB-6.x-green) ![Mongoose](https://img.shields.io/badge/Mongoose-8.x-green) ![JWT](https://img.shields.io/badge/JWT-Authentication-yellow) ![REST API](https://img.shields.io/badge/REST-API-orange)\n\n**TaskJS** is a RESTful API built with **Express.js** and **Node.js** that allows users to register accounts, log in, and manage personal tasks. The API uses **JSON Web Tokens (JWT)** for authentication and **MongoDB** for data storage via **Mongoose**.\n\n## Features\n\n- **User Registration and Authentication**: Enables user sign-up and login with JWT for secure access.\n- **Task Management**: Full CRUD (Create, Read, Update, Delete) functionality for personal tasks.\n- **Protected Routes**: Secure access to routes using JWT authentication.\n- **MongoDB with Mongoose**: Simplified database interactions for managing MongoDB documents.\n  \n## Technologies Used\n\n- **Node.js**: JavaScript runtime environment for the server.\n- **Express.js**: Web application framework built on Node.js.\n- **MongoDB**: NoSQL database to store users and tasks.\n- **Mongoose**: ODM to facilitate MongoDB interactions.\n- **JSON Web Tokens (JWT)**: Secure method for user authentication.\n- **bcrypt.js**: Library for password hashing.\n\n## Installation\n\nFollow these steps to install and run the project locally:\n\n1. **Clone the repository**:\n```bash\ngit clone https://github.com/EmiliodDev/TaskJS.git\ncd TaskJS\n```\n\n2. **Install the dependencies**:\n```bash\nnpm install\n```\n\n3. **Set up environment variables**:\n\n   Create a `.env` file in the root directory of the project with the following information:\n```.env\nMONGO_URI=\u003cyour-mongo-url\u003e\nJWT_SECRET=\u003cyour-jwt-secret\u003e\n``` \n\n4. **Start the server**:\n```bash\nnode server/main.js\n```\n\n## Endpoints\n\n| Method | URL | Action |\n|--------|-----|--------|\n|POST    |/register| register a user|\n|POST| /login| logs in a user |\n|POST|/tasks/:userId|creates a new task associated with the specified user|\n|PUT|/tasks/:taskId| updates an existing task|\n|GET|/tasks|retrieves all the user's tasks|\n|DELETE | /tasks/:taskId| delete a specified task|\n\nGo to:\n\n- [Register](#register)\n- [Login](#login)\n- [Create a new task](#create-task)\n- [Update a task](#update-task)\n- [Get a list of tasks](#get-all-tasks)\n- [Delete a task](#delete-task)\n\n### **Register**\n\nRegister a new user with the credentials provided.\n\n|**URL**|**Method**|**Request params**|\n|-------|----------|------------------|\n|`/register`|`POST`|`none`|\n\n- **Request Body:**\n\n```json\n{\n  \"username\": \"example\",\n  \"password\": \"password123\",\n  \"email\": \"example@email.com\"\n}\n```\n\n- **Successful response**\n\n  - Code: 201 (Created)\n  - Response Body:\n\n  ```json\n  {\n    \"message\": \"user created\"\n  }\n  ```\n\n- **Error Response**\n  - Code: 400 (Bad Request)\n  - Response Body:\n  ```json\n  {\n    \"error\": \"User already exists\"\n  }\n  ```\n  - Code: 500 (Internal Server Error)\n  - Response Body:\n  ```json\n  {\n    \"error\": \"Something went wrong\"\n  }\n  ```\n\n\u003e Note: You can see an example usage in `examples/register.js`\n\n### **Login**\n\nLogs in a user with the provided credentials.\n\n|**URL**|**Method**|**Request params**|\n|-------|----------|------------------|\n|`/login`|`POST`|`none`|\n\n- **Request Body:**\n\n```json\n{\n  \"email\": \"example@example.com\",\n  \"password\": \"password123\"\n}\n```\n\n- **Successful Response**\n  - Code: 200 (OK)\n  - Response Body:\n  ```json\n  {\n    \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n  }\n  ```\n- **Error response**\n  - Code: 401 (Unauthorized)\n  - Response Body:\n  ```json\n  {\n    \"error\": \"Invalid username or password\"\n  }\n  ```\n  - Code: 500 (Internal Server Error)\n  - Response Body:\n  ```json\n  {\n    \"error\": \"Something went wrong\"\n  }\n  ```\n\n\u003e Note: You can see an example usage in `examples/login.js`\n\n### **Create Task**\n\nCreates a new task associated with the specified user.\n\n|**URL**|**Method**|**URL Parameters**|**Headers**|\n|-------|----------|------------------|-----------|\n|`/tasks/:userId`|`POST`|`userId` - The ID of the user to associate the task with.|`Authorization: Bearer \u003ctoken\u003e` - The access token obtained after logging in.|\n\n- **Request Body**\n\n  - `title` (required): The title of the task.\n  - `isCompleted`: Indicates whether the task is completed (default: `false`).\n  - `description`: The description of the task.\n  - `time`: The time associated with the task.\n  - `date`: The date of the task.\n  - `iisNotificationEnabled`: Indicates whether notifications are enabled for the task (default: `false`).\n  - `repeatDays`: An array of days when the task is repeated.\n\n- **Successful Response**\n\n  - Code: 200 (OK)\n  - Response Body:\n\n  ```json\n  {\n    \"message\": \"Task created\",\n    \"task\": {\n      \"_id\": \"task_id\",\n      \"title\": \"Task Title\",\n      \"isCompleted\": false,\n      \"description\": \"Task Description\",\n      \"time\": \"Task Time\",\n      \"date\": \"Task Date\",\n      \"isNotificationEnabled\": false,\n      \"repeatDays\": [\"Monday\", \"Wednesday\"],\n      \"user\": \"user_id\",\n      \"createdAt\": \"2023-06-07T12:00:00Z\",\n      \"updatedAt\": \"2023-06-07T12:00:00Z\"\n    }\n  }\n  ```\n\n- **Error Response**\n  - Code: 500 (Internal Server Error)\n  - Response Body:\n    ```json\n    {\n      \"error\": \"Something went wrong\"\n    }\n    ```\n\n\u003e Note: You can see an example usage in `examples/createTask.js`\n\n### **Update Task**\n\nUpdates an existing task\n\n|**URL**|**Method**|**URL Parameters**|**Headers**|\n|-------|----------|------------------|-----------|\n|`/tasks/:taskId`|`PUT`|`taskId` - The ID of the task to be updated.|`Authorization: Bearer \u003ctoken\u003e` - The access token obtained after logging in.|\n\n- **Request Body**\n\n  - `title` (required): The title of the task.\n  - `isCompleted`: Indicates whether the task is completed (default: `false`).\n  - `description`: The description of the task.\n  - `time`: The time associated with the task.\n  - `date`: The date of the task.\n  - `iisNotificationEnabled`: Indicates whether notifications are enabled for the task (default: `false`).\n  - `repeatDays`: An array of days when the task is repeated.\n\n- **Successful Response**\n\n  - Code: 200 (OK)\n  - Response Body:\n\n  ```json\n  {\n    \"message\": \"Task updated\",\n    \"task\": {\n      \"_id\": \"task_id\",\n      \"title\": \"Updated Task Title\",\n      \"isCompleted\": true,\n      \"description\": \"Updated Task Description\",\n      \"time\": \"Updated Task Time\",\n      \"date\": \"Updated Task Date\",\n      \"isNotificationEnabled\": true,\n      \"repeatDays\": [\"Monday\", \"Tuesday\"],\n      \"user\": \"user_id\",\n      \"createdAt\": \"2023-06-07T12:00:00Z\",\n      \"updatedAt\": \"2023-06-07T12:30:00Z\"\n    }\n  }\n  ```\n\n  - **Error Response**\n\n    - Code: 404 (Not Found)\n    - Response Body:\n\n    ```json\n    {\n      \"message\": \"Task not found\"\n    }\n    ```\n\n\u003e Note: You can see an example usage in `examples/updateTask.js`\n\n### **Get All Tasks**\n\nRetrieves all the user's tasks\n\n|**URL**|**Method**|**Headers**|\n|-------|----------|-----------|\n|`/tasks`|`GET`|`Authorization: Bearer \u003ctoken\u003e` - The access token obtained after logging in.|\n  \n- **Successful Response**\n\n  - Code: 200 (OK)\n  - Response Body:\n\n  ```json\n  {\n    \"tasks\": [\n      {\n        \"_id\": \"task_id1\",\n        \"title\": \"Task 1\",\n        \"isCompleted\": false,\n        \"description\": \"Task 1 description\",\n        \"time\": \"09:00\",\n        \"date\": \"2023-06-07\",\n        \"isNotificationEnabled\": true,\n        \"repeatDays\": [\"Monday\", \"Wednesday\"],\n        \"user\": \"user_id\",\n        \"createdAt\": \"2023-06-07T08:00:00Z\",\n        \"updatedAt\": \"2023-06-07T09:30:00Z\"\n      },\n      {\n        \"_id\": \"task_id2\",\n        \"title\": \"Task 2\",\n        \"isCompleted\": true,\n        \"description\": \"Task 2 description\",\n        \"time\": \"13:00\",\n        \"date\": \"2023-06-08\",\n        \"isNotificationEnabled\": false,\n        \"repeatDays\": [],\n        \"user\": \"user_id\",\n        \"createdAt\": \"2023-06-07T10:00:00Z\",\n        \"updatedAt\": \"2023-06-07T11:45:00Z\"\n      }\n    ]\n  }\n  ```\n\n- **Error Response**\n\n  - Code: 500 (Internal Server Error)\n  - Response Body:\n\n  ```json\n  {\n    \"error\": \"Something went wrong\"\n  }\n  ```\n\n\u003e Note: You can see an example usage in `examples/getAllTasks.js`\n\n### **Delete Task**\n\nDelete a task.\n\n|**URL**|**Method**|**Headers**|**URL Parameters**|\n|-------|----------|-----------|------------------|\n|`/tasks/:taskId`|`DELETE`|  `Authorization: Bearer \u003ctoken\u003e` - The access token obtained after logging in.|`taskId` - The ID of the task to delete.|\n\n- **Successful Response**\n\n  - Code: 200 (OK)\n  - Response Body:\n\n  ```json\n  {\n    \"message\": \"Task deleted successfully\"\n  }\n  ```\n\n- **Error Response**\n\n  - Code: 400 (Bad request)\n  - Response Body:\n\n  ```json\n  {\n    \"message\": \"Task not found\"\n  }\n  ```\n\n  - Code: 500 (Internal Server Error)\n  - Response Body:\n\n  ```json\n  {\n    \"error\": \"Something went wrong\"\n  }\n  ```\n\n\u003e Note: You can see an example usage in `examples/deleteTask.js`\n\n# License\n\nLicensed under:\n\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilioddev%2Ftaskjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femilioddev%2Ftaskjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilioddev%2Ftaskjs/lists"}