{"id":23235770,"url":"https://github.com/hack-light/basic-node-hngx","last_synced_at":"2025-09-05T10:42:54.748Z","repository":{"id":193209514,"uuid":"688337641","full_name":"Hack-Light/basic-node-hngx","owner":"Hack-Light","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-11T19:25:42.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T20:57:43.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Hack-Light.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":"2023-09-07T06:31:30.000Z","updated_at":"2023-09-07T06:32:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"17ff3554-a906-4ed9-8100-7eb317d774f3","html_url":"https://github.com/Hack-Light/basic-node-hngx","commit_stats":null,"previous_names":["hack-light/basic-node-hngx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fbasic-node-hngx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fbasic-node-hngx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fbasic-node-hngx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fbasic-node-hngx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hack-Light","download_url":"https://codeload.github.com/Hack-Light/basic-node-hngx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399889,"owners_count":20932876,"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-12-19T03:29:30.586Z","updated_at":"2025-04-05T20:34:58.602Z","avatar_url":"https://github.com/Hack-Light.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## API Documentation\n\n#### Create a New Person\n\n- **Request**:\n\n  - Method: POST\n  - Endpoint: `/api/people`\n  - Headers:\n    - Content-Type: application/json\n  - Body:\n    ```json\n    {\n      \"name\": \"John Doe\"\n    }\n    ```\n\n- **Response**:\n  - Status Code: 201 Created\n  - Body:\n    ```json\n    {\n      \"_id\": \"some_unique_id\",\n      \"name\": \"John Doe\"\n    }\n    ```\n\n#### Get People (with optional name filter)\n\n- **Request**:\n\n  - Method: GET\n  - Endpoint: `/api/people`\n  - Query Parameters (optional):\n    - name: String (e.g., \"John Doe\")\n\n- **Response**:\n  - Status Code: 200 OK\n  - Body:\n    ```json\n    [\n      {\n        \"_id\": \"some_unique_id\",\n        \"name\": \"John Doe\"\n      }\n      // Other person objects\n    ]\n    ```\n\n#### Get a Person by ID\n\n- **Request**:\n\n  - Method: GET\n  - Endpoint: `/api/people/{person_id}`\n\n- **Response**:\n  - Status Code: 200 OK\n  - Body:\n    ```json\n    {\n      \"_id\": \"some_unique_id\",\n      \"name\": \"John Doe\"\n    }\n    ```\n\n#### Update a Person by ID\n\n- **Request**:\n\n  - Method: PUT\n  - Endpoint: `/api/people/{person_id}`\n  - Headers:\n    - Content-Type: application/json\n  - Body:\n    ```json\n    {\n      \"name\": \"Updated Name\"\n    }\n    ```\n\n- **Response**:\n  - Status Code: 200 OK\n  - Body:\n    ```json\n    {\n      \"_id\": \"some_unique_id\",\n      \"name\": \"Updated Name\"\n    }\n    ```\n\n#### Delete a Person by ID\n\n- **Request**:\n\n  - Method: DELETE\n  - Endpoint: `/api/people/{person_id}`\n\n- **Response**:\n  - Status Code: 200 OK\n  - Body:\n    ```json\n    {\n      \"_id\": \"some_unique_id\",\n      \"name\": \"John Doe\"\n    }\n    ```\n\n### Sample Usage\n\n#### Create a New Person\n\n```http\nPOST /api/people\nContent-Type: application/json\n\n{\n  \"name\": \"John Doe\",\n}\n```\n\n#### Get People (with name filter)\n\n```http\nGET /api/people?name=John Doe\n```\n\n#### Get a Person by ID\n\n```http\nGET /api/people/{person_id}\n```\n\n#### Update a Person by ID\n\n```http\nPUT /api/people/{person_id}\nContent-Type: application/json\n\n{\n  \"name\": \"Updated Name\",\n}\n```\n\n#### Delete a Person by ID\n\n```http\nDELETE /api/people/{person_id}\n```\n\n### Limitations and Assumptions\n\n- The API assumes that the \"name\" field is a string and enforces this validation.\n\n### Setup and Deployment\n\nTo set up and deploy the API, follow these steps:\n\n#### Local Development\n\n1. Clone the GitHub repository:\n\n   ```bash\n   git clone https://github.com/your-username/your-repo.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```bash\n   cd your-repo\n   ```\n\n3. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n4. Start the API locally:\n\n   ```bash\n   node app.js\n   ```\n\n5. Access the API at `http://localhost:3000`.\n\n### Testing\n\nTo test the api run `npm run test`\n\n\n### UML Diagram (Optional)\n\n![uml diagram](./uml.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhack-light%2Fbasic-node-hngx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhack-light%2Fbasic-node-hngx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhack-light%2Fbasic-node-hngx/lists"}