{"id":18597035,"url":"https://github.com/focusaurus/code-test-303-node","last_synced_at":"2025-10-28T18:50:41.381Z","repository":{"id":141309094,"uuid":"145472440","full_name":"focusaurus/code-test-303-node","owner":"focusaurus","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-20T21:46:26.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T13:52:41.087Z","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/focusaurus.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":"2018-08-20T21:30:17.000Z","updated_at":"2018-08-20T21:46:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"a17741d4-e7ef-46c3-a6ee-46ca80f0691a","html_url":"https://github.com/focusaurus/code-test-303-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/focusaurus/code-test-303-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fcode-test-303-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fcode-test-303-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fcode-test-303-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fcode-test-303-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/focusaurus","download_url":"https://codeload.github.com/focusaurus/code-test-303-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fcode-test-303-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281495098,"owners_count":26511349,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-07T01:26:43.937Z","updated_at":"2025-10-28T18:50:41.345Z","avatar_url":"https://github.com/focusaurus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 303 Software Coding Test\n\n## How to set up for development the first time\n\n- Install docker and docker compose\n- Clone this repo\n- Build the docker image\n  - `./bin/docker-build.sh`\n- Get a shell in the api container\n  - `./bin/docker-run.sh`\n- create the database in docker\n  - Run this command from your host shell\n  - `docker-compose exec postgres su - postgres -c 'createdb api'`\n- Load DB schema and seeds\n  - `knex migrate:latest`\n  - `knex seed:run`\n\n## How to do normal development tasks\n\n- Get a shell in the docker container\n  - `./bin/docker-run.sh`\n- start the server (from a shell in the container)\n  - `npm start`\n  - or `node .`\n  - or `node-dev .`\n- debug the server (from a shell in the container)\n  - `node --inspect=0.0.0.0:9229 .`\n  - On your host, run chrome and navigate to `chrome://inspect/#devices`\n  - Click on \"Remote Target \u003e inspect\"\n- autoformat the code (from a shell in the container)\n  - `npm run format`\n- run the lint static analysis (from a shell in the container)\n  - `npm run lint`\n- Get a psql prompt (from a host shell)\n  - `docker-compose exec postgres su - postgres -c 'psql api'`\n\n## API Documentation\n\nThe server provides an HTTP interface at base URL `http://localhost:3000` when running locally. All v1 endpoints paths start with the prefix `/api/v1`.\n\n**Posts**\n\n- Create a post\n  - HTTP Method: `POST`\n  - Path: `/api/v1/posts`\n  - JSON Body is an object with the following fields\n    - `title` (string, required): The post title\n    - `author` (string): The post author name or id\n    - `content` (string): The post content (body text)\n  - Response is JSON object with the new post fields\n- View a post\n  - HTTP Method: `GET`\n  - Path: `/api/v1/posts/{postId}`\n  - `postId` path field should be a positive integer\n  - Response is JSON object with the post fields\n- Update a post\n  - HTTP Method: `PATCH`\n  - Path: `/api/v1/posts/{postId}`\n    - `postId` path field should be a positive integer\n  - JSON Body is an object with the following fields\n    - `title` (string, optional): The updated post title\n    - `author` (string, optional): The updated post author name or id\n    - `content` (string, optional): The updated post content (body text)\n  - Response is JSON object with the updated post fields\n- Delete a post\n  - HTTP Method: `DELETE`\n  - Path: `/api/v1/posts/{postId}`\n  - `postId` path field should be a positive integer\n  - Response is empty\n\n## TODO Remaining Tasks\n\n90 minutes is not a lot of time, so I skipped\n\n- Input validation\n  - optional vs required fields\n  - string length limits\n  - numeric ids\n- Unit tests, especially for edge cases and error handling\n- Pagination for the get all posts route\n- API docs with a conventional tool like OpenAPI/Swagger\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocusaurus%2Fcode-test-303-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffocusaurus%2Fcode-test-303-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocusaurus%2Fcode-test-303-node/lists"}