{"id":20406005,"url":"https://github.com/miguelhp373/node-deploy-with-render","last_synced_at":"2026-04-11T09:02:42.003Z","repository":{"id":170190593,"uuid":"646313950","full_name":"miguelhp373/node-deploy-with-render","owner":"miguelhp373","description":"This is an example of a local API using Express.js. The API allows manipulating a collection of users by providing operations such as listing all users, getting a user by ID, adding a new user, updating an existing user, and deleting a user.","archived":false,"fork":false,"pushed_at":"2023-12-05T02:30:08.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T22:08:50.767Z","etag":null,"topics":["express","https","nodejs","render","rest-api"],"latest_commit_sha":null,"homepage":"https://api-users-for-tests.onrender.com/users/all","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/miguelhp373.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":"2023-05-28T01:34:37.000Z","updated_at":"2023-11-02T02:12:50.000Z","dependencies_parsed_at":"2023-12-05T03:30:07.376Z","dependency_job_id":null,"html_url":"https://github.com/miguelhp373/node-deploy-with-render","commit_stats":null,"previous_names":["miguelhp373/node-deploy-with-render"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/miguelhp373/node-deploy-with-render","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelhp373%2Fnode-deploy-with-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelhp373%2Fnode-deploy-with-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelhp373%2Fnode-deploy-with-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelhp373%2Fnode-deploy-with-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miguelhp373","download_url":"https://codeload.github.com/miguelhp373/node-deploy-with-render/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelhp373%2Fnode-deploy-with-render/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31674624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: 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":["express","https","nodejs","render","rest-api"],"created_at":"2024-11-15T05:14:18.964Z","updated_at":"2026-04-11T09:02:41.984Z","avatar_url":"https://github.com/miguelhp373.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST API For Tests\n\nThis is an example of a local API using Express.js. The API allows manipulating a collection of users by providing operations such as listing all users, getting a user by ID, adding a new user, updating an existing user, and deleting a user.\n\n## Technologies\n- ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge\u0026logo=node.js\u0026logoColor=white)\n- ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge\u0026logo=express\u0026logoColor=%2361DAFB)\n\n## Configuration\n\nMake sure you have Node.js installed on your machine.\n\n1. Clone the repository or create a new directory for the project.\n2. Navigate to the project's root directory.\n\n## Installation\n\nRun the following command to install the necessary dependencies:\n\n```\nnpm install\n```\n\n## Running the API\n\nRun the following command to start the API on a local server:\n\n```\nnpm start\n```\n\nThe server will be started at `localhost:3000`.\n\n## Endpoints\n\n### List all users\n\nReturns a list of all users.\n\n- **URL:** `/users/all`\n- **Method:** `GET`\n- **Success response:** Status 200 (OK)\n- **Example response:**\n\n```json\n[\n  {\n    \"id\": \"cd1c78e4-5a3d-4d57-b832-784fb5ce6730\",\n    \"name\": \"John Doe\",\n    \"date_created\": \"2023-05-25T12:34:56.789Z\",\n    \"image_link\": \"https://source.unsplash.com/random/200x200/?person\"\n  },\n  {\n    \"id\": \"42cf52da-7a5a-487b-a0de-89474f158ed0\",\n    \"name\": \"Jane Smith\",\n    \"date_created\": \"2023-05-25T12:34:56.789Z\",\n    \"image_link\": \"https://source.unsplash.com/random/200x200/?face\"\n  }\n]\n```\n\n### Get a user by ID\n\nReturns a single user based on the provided ID.\n\n- **URL:** `/users/:id`\n- **Method:** `GET`\n- **Path parameter:** `id` (string) - The user ID\n- **Success response:** Status 200 (OK)\n- **User not found response:** Status 404 (Not Found)\n- **Example response for found user:**\n\n```json\n{\n  \"id\": \"cd1c78e4-5a3d-4d57-b832-784fb5ce6730\",\n  \"name\": \"John Doe\",\n  \"date_created\": \"2023-05-25T12:34:56.789Z\",\n  \"image_link\": \"https://source.unsplash.com/random/200x200/?person\"\n}\n```\n\n### Add a new user\n\nAdds a new user to the collection.\n\n- **URL:** `/users`\n- **Method:** `POST`\n- **Request body:** JSON object containing user data (name)\n- **Success response:** Status 200 (OK)\n- **Example request body:**\n\n```json\n{\n  \"name\": \"Emily Brown\"\n}\n```\n\n- **Example success response:**\n\n```json\n{\n  \"id\": \"12345678-abcd-efgh-ijkl-1234567890ab\",\n  \"name\": \"Emily Brown\",\n  \"date_created\": \"2023-05-25T12:34:56.789Z\",\n  \"image_link\": \"https://static.vecteezy.com/system/resources/thumbnails/004/511/281/small/default-avatar-photo-placeholder-profile-picture-vector.jpg\"\n}\n```\n\n### Update an existing user\n\nUpdates the details of an existing user based on the provided ID.\n\n- **URL:** `/users/:id`\n- **Method:** `PATCH`\n- **Path parameter:** `id` (string) - The user ID\n- **Request body:** JSON object containing the user data to be updated (name)\n- **Success response:** Status 200 (OK)\n- **User not found response:** Status 404 (Not Found)\n- **Example request body:**\n\n```json\n{\n  \"name\": \"New user name\"\n}\n```\n\n- **Example success response:**\n\n```json\n{\n  \"id\": \"cd1c78e4-5a3d-4d57-b832-784fb5ce6730\",\n  \"name\": \"New user name\",\n  \"date_created\": \"2023-05-25T12:34:56.789Z\",\n  \"image_link\": \"https://source.unsplash.com/random/200x200/?person\"\n}\n```\n\n### Delete a user\n\nDeletes a user from the collection based on the provided ID.\n\n- **URL:** `/users/:id`\n- **Method:** `DELETE`\n- **Path parameter:** `id` (string) - The user ID\n- **Success response:** Status 200 (OK)\n- **User not found response:** Status 404 (Not Found)\n- **Example success response:**\n\n```json\n{\n  \"message\": \"User deleted successfully\"\n}\n```\n\n## CORS\n\nThe API has been configured to allow Cross-Origin Resource Sharing (CORS). The CORS settings include allowing all origins to access the API, allowing credentials, setting allowed headers, and allowed methods. These settings are applied to all API routes.\n\n```javascript\nconst cors = require('cors');\n\nconst corsOptions = {\n  origin: '*', // Defines the allowed origin (all domains)\n  credentials: true, // Allows the use of cookies and authorization headers with HTTPS\n  allowedHeaders: 'Origin,Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,locale', // Defines the allowed headers\n  methods: 'GET,PUT,POST,PATCH,DELETE,OPTIONS' // Defines the allowed methods\n};\n\nconst corsMiddleware = cors(corsOptions);\n\nuserRoutes.use(corsMiddleware); // Applies the cors middleware\n```\n\nThis allows you to make requests to the API from any origin, using the specified methods and headers.\n\nThis project is licensed under the [MIT License](LICENSE) - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelhp373%2Fnode-deploy-with-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiguelhp373%2Fnode-deploy-with-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelhp373%2Fnode-deploy-with-render/lists"}