{"id":15938900,"url":"https://github.com/whyboris/express-knex-api","last_synced_at":"2026-01-30T12:34:10.914Z","repository":{"id":44315197,"uuid":"234666123","full_name":"whyboris/express-knex-api","owner":"whyboris","description":"RESTful API server - Express \u0026 Knex - search and update MySQL database data","archived":false,"fork":false,"pushed_at":"2023-07-11T13:49:45.000Z","size":674,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T16:48:53.993Z","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/whyboris.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":"2020-01-18T01:41:21.000Z","updated_at":"2022-10-06T10:18:00.000Z","dependencies_parsed_at":"2024-12-16T23:10:40.743Z","dependency_job_id":"342b0c6d-b47c-4140-8d11-71ea268420c8","html_url":"https://github.com/whyboris/express-knex-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/whyboris/express-knex-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2Fexpress-knex-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2Fexpress-knex-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2Fexpress-knex-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2Fexpress-knex-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whyboris","download_url":"https://codeload.github.com/whyboris/express-knex-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyboris%2Fexpress-knex-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"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":[],"created_at":"2024-10-07T05:43:09.248Z","updated_at":"2026-01-30T12:34:10.895Z","avatar_url":"https://github.com/whyboris.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BUSINESSES API\n\nA _RESTful API_ that interacts with busisenss data. Allows to *GET* search and *PUT* create/update of businesses.\n\n### GET\n\n`/business` allows any combination of these parameters:\n\n| param   | search type |\n| ------- | ----------- |\n| uuid    | exact match |\n| name    | substring search |\n| address | substring search |\n| city    | exact match |\n| state   | exact match |\n\nAll searches and matches are case insensitive (e.g. \"NJ\" is the same as \"nj\").\n\n### PUT\n\n`/business` requires a `JSON` body. It will:\n\n- update a business if `uuid` is provided and matches an existing business, or\n- create a business if `uuid` is not provided\n    - duplicate requests will result in 'duplicate' error returned to user\n\n### Development\n\n- update `.env` file with your _MySQL_ credentials, database, and table name\n- `npm run dev` will start [nodemon](https://github.com/remy/nodemon) which will reload the server when `index.js` is updated\n\n### Notes\n\n- `.env` file should not be committed to a repository, it is included here for demonstration only\n- We are using [knex](https://github.com/knex/knex) query builder to avoid SQL injections\n- The `uuid` column (_varchar(40)_) in the table is _primary_ so it will not allow duplicate entries\n- We are using [object-hash](https://github.com/puleos/object-hash) to generate a unique hash for `/PUT` requests that do not have a `uuid` value.\n   - This will make sure that subsequent calls with the exact same values will generate the same hash and prevent duplicate entries\n   - Unfortunately, even though the column is named \"uuid\" it will contain hashes that do not match the [uuid format](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).\n- We are using [pm2](https://github.com/Unitech/pm2) to run the server (`npm start`) and to automatically restart it if it ever fails. Run `npm run stop` to stop it.\n\n### Todo\n\n- Insert `created_at` formatted appropriately when creating a resource\n- Paginate results (currently searching with no arguments will respond with all businesses in the database)\n- Add logging of errors on the server so as to fix problems when they come up\n- Create a schema for the MySQL table and include in repository\n- Migrate code to _TypeScript_ to catch more errors and have a better coding experience\n- Rename `.env` file to `.env-example` with dummy values and add \".env\" to `.gitignore`\n- Add any appropriate tests (e.g. unit, integration, e2e, load)\n- Move the `getCleanObjectForDB` method to another file for a cleaner `index.js` file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyboris%2Fexpress-knex-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhyboris%2Fexpress-knex-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyboris%2Fexpress-knex-api/lists"}