{"id":21595011,"url":"https://github.com/thirdmadman/nodejs-2023-q2-crud-api","last_synced_at":"2025-07-21T06:33:33.929Z","repository":{"id":177716607,"uuid":"658907238","full_name":"thirdmadman/nodejs-2023-q2-crud-api","owner":"thirdmadman","description":"Simple CRUD API using in-memory database underneath.","archived":false,"fork":false,"pushed_at":"2024-11-28T20:47:46.000Z","size":214,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T10:47:33.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thirdmadman.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-06-26T18:33:32.000Z","updated_at":"2024-11-24T21:51:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"9803182d-498e-4e23-b9d1-9fbd06451b56","html_url":"https://github.com/thirdmadman/nodejs-2023-q2-crud-api","commit_stats":null,"previous_names":["thirdmadman/nodejs-2023-q2-crud-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thirdmadman/nodejs-2023-q2-crud-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs-2023-q2-crud-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs-2023-q2-crud-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs-2023-q2-crud-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs-2023-q2-crud-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thirdmadman","download_url":"https://codeload.github.com/thirdmadman/nodejs-2023-q2-crud-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs-2023-q2-crud-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266253704,"owners_count":23900055,"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":[],"created_at":"2024-11-24T17:24:34.476Z","updated_at":"2025-07-21T06:33:28.919Z","avatar_url":"https://github.com/thirdmadman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodejs-2023-q2-crud-api\n\n## Description\n\nSimple CRUD API using in-memory database underneath.\n\n### Build scenarios\n\nImplemented tow build scenarios:\n\n* No bundle - use ```start:prod-no-bundle```, to build app in ```dist``` directory. Uses tsc and its config.\n* Bundle all in one file, to build app in one file in ```build``` directory. Uses webpack and its config.\n\n### About architecture\n\nUsed simplified MVC with DTO.\nFor API output used standards from \u003chttps://jsonapi.org/\u003e.\n\nDuring to shortage of time on development, some concepts may be different/degraded/absent.\n\nBy the same reason, DB implementation represented in static object.\n\n## Usage\n\n1. Clone project\n2. Install dependencies by running ```npm i```\n3. Modify ```.env.example``` to your needs and then rename it into ```.env```\n4. Launch server\n    1. Launch server in ```development``` mode by running ```npm run start:dev```\n    2. Launch server in ```production``` by running ```npm run start:prod```\n\n## Endpoints\n\n### api/users\n\n* **GET** `api/users` is used to get all ```User```\n  * Answer with `status code` **200** and all ```User``` records\n* **GET** `api/users/{userId}` is used to get specific ```User```\n  * Answer with `status code` **200** and record with `id === userId` if it exists\n  * Answer with `status code` **400** and corresponding message if `userId` is invalid (not `uuid`)\n  * Answer with `status code` **404** and corresponding message if record with `id === userId` doesn't exist\n* **POST** `api/users` is used to create record about new ```User``` and store it in database\n  * Answer with `status code` **201** and newly created record\n  * Answer with `status code` **400** and corresponding message if request `body` does not contain **required** fields\n* **PUT** `api/users/{userId}` is used to update existing ```User```\n  * Answer with `status code` **200** and updated record\n  * Answer with `status code` **400** and corresponding message if `userId` is invalid (not `uuid`)\n  * Answer with ` status code` **404** and corresponding message if record with `id === userId` doesn't exist\n* **DELETE** `api/users/{userId}` is used to delete existing ```User``` from database\n  * Answer with `status code` **204** if the record is found and deleted\n  * Answer with `status code` **400** and corresponding message if `userId` is invalid (not `uuid`)\n  * Answer with `status code` **404** and corresponding message if record with `id === userId` doesn't exist\n\nResponse body form server on success will be in JSON object with field ```data``` witch is Array of ```User```.\n\nExample:\n\n```json\n{\n    \"data\": [\n        {\n            \"uuid\": \"efc5c092-9517-420d-a837-9b503f61a369\",\n            \"name\": \"Sam\",\n            \"age\": 22,\n            \"hobbies\": []\n        }\n    ]\n}\n```\n\nResponse body form server on error will be in JSON object with field ```errors``` witch is Array of object with field title type of sting.\n\nExample:\n\n```json\n{\n    \"errors\": [\n        {\n            \"title\": \"User not found\"\n        }\n    ]\n}\n```\n\nRequest body should follow this schema:  \n\n```ts\n{\n  \"username\": string,\n  \"age\": number,\n  \"hobbies\": Array\u003cString\u003e\n}\n```\n\nExample:\n\n```json\n{\n    \"name\": \"Sam\",\n    \"age\": 22,\n    \"hobbies\": []\n}\n```\n\nNote: it's allowed to send in this object field uuid, but this field will be ignored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdmadman%2Fnodejs-2023-q2-crud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthirdmadman%2Fnodejs-2023-q2-crud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdmadman%2Fnodejs-2023-q2-crud-api/lists"}