{"id":14989467,"url":"https://github.com/s-pro/koa2-starter","last_synced_at":"2025-04-12T01:17:01.758Z","repository":{"id":86312963,"uuid":"79704774","full_name":"S-PRO/koa2-starter","owner":"S-PRO","description":"Koa2 starter RESTful application","archived":false,"fork":false,"pushed_at":"2017-06-08T22:00:40.000Z","size":57,"stargazers_count":6,"open_issues_count":2,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-12T01:16:54.846Z","etag":null,"topics":["koa","koa2","koajs","mysql","nodejs","sequelize"],"latest_commit_sha":null,"homepage":"","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/S-PRO.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":"2017-01-22T08:31:25.000Z","updated_at":"2019-04-10T01:50:09.000Z","dependencies_parsed_at":"2023-03-13T09:46:16.149Z","dependency_job_id":null,"html_url":"https://github.com/S-PRO/koa2-starter","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"a63f43ddf57789c4bafc43d5aa83577268189d9c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S-PRO%2Fkoa2-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S-PRO%2Fkoa2-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S-PRO%2Fkoa2-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S-PRO%2Fkoa2-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/S-PRO","download_url":"https://codeload.github.com/S-PRO/koa2-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501859,"owners_count":21114684,"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":["koa","koa2","koajs","mysql","nodejs","sequelize"],"created_at":"2024-09-24T14:18:25.052Z","updated_at":"2025-04-12T01:17:01.729Z","avatar_url":"https://github.com/S-PRO.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koa2 starter REST API application\n\n## Technologies:\n\n- Koa v2\n- MySQL\n- JSON Schema\n- Yarn\n- ESLint\n- Git hooks\n\n## Getting started\n\nCreate data base:\n\n    CREATE DATABASE `koa2-starter` CHARACTER SET utf8 COLLATE utf8_general_ci;\n\nInstall Sequelize CLI:\n\n    $ npm i -g sequelize-cli\n\nInstall dependencies:\n\n    $ yarn install\n\nMake migrations and seeds:\n\n    $ sequelize db:migrate\n    $ sequelize db:seed:all\n\nRun locally:\n\n    $ npm start\n\n## Project structure\n\n```\n.\n└── app/  --\u003e Application files\n    ├── config/\n    |   ├── app.confg.js    --\u003e App config: port, base url, etc...\n    |   └── database.json   --\u003e databes configuration file generated by sequelize cli\n    ├── middlewares/  --\u003e All custom middlewares should be stored in this folder\n    ├── migrations/   --\u003e Migrations generated by sequelize cli\n    ├── models/       --\u003e Models generated sequelize cli\n    ├── seeders/      --\u003e Seeds generated sequelize cli\n    ├── src/          --\u003e All endpoints should be stored inside this folder\n    |   └── user/\n    |       ├── router.js           --\u003e Required file. Should be inside each endpoint. Contains koa router instance.\n    |       ├── user.controller.js  --\u003e Routes handlers\n    |       └── schemas/\n    |           ├── index.js            --\u003e Collect all schemas  \n    |           └── create.schema.json  --\u003e JSON Schema\n    ├── utils/        --\u003e Application common utils\n    └── index.js      --\u003e Application entry point\n\n```\n\n## Endpoints\n\n    $ http GET localhost:3000/user\n\n```json\n{\n  \"users\": [\n    {\n      \"createdAt\": \"2017-01-22T14:21:46.000Z\",\n      \"email\": \"foo@bar.com\",\n      \"first_name\": \"foo\",\n      \"id\": 4,\n      \"last_name\": \"bar\",\n      \"status\": \"active\",\n      \"updatedAt\": \"2017-01-22T14:21:46.000Z\"\n    }\n  ]\n}\n```\n\n    $ http GET localhost:3000/user/:id\n\n```json\n{\n  \"user\": {\n    \"createdAt\": \"2017-01-22T14:21:46.000Z\",\n    \"email\": \"foo@bar.com\",\n    \"first_name\": \"foo\",\n    \"id\": 4,\n    \"last_name\": \"bar\",\n    \"status\": \"active\",\n    \"updatedAt\": \"2017-01-22T14:21:46.000Z\"\n  }\n}\n```\n\n    $ http POST localhost:3000/user first_name=foo last_name=bar password=qwerty email=foo@bar.com\n\n```json\n{\n  \"user\": {\n    \"createdAt\": \"2017-01-22T14:21:46.000Z\",\n    \"email\": \"foo@bar.com\",\n    \"first_name\": \"foo\",\n    \"id\": 4,\n    \"last_name\": \"bar\",\n    \"status\": \"active\",\n    \"updatedAt\": \"2017-01-22T14:21:46.000Z\"\n  }\n}\n```\n\n    $ http PUT localhost:3000/user first_name=another_name last_name=bar email=foo@bar.com\n\n```json\n{\n  \"user\": {\n    \"createdAt\": \"2017-01-22T14:21:46.000Z\",\n    \"email\": \"foo@bar.com\",\n    \"first_name\": \"another_name\",\n    \"id\": 4,\n    \"last_name\": \"bar\",\n    \"status\": \"active\",\n    \"updatedAt\": \"2017-01-22T14:21:46.000Z\"\n  }\n}\n```\n\n    $ http DELETE localhost:3000/user/:id\n\n```json\n\"204 No Content\"\n```\n\n## TODO\n\n- [ ] Add unit tests\n- [ ] Move validator to separate repo\n- [ ] Add production deployment system\n- [ ] Add /login \u0026\u0026 /posts\n- [ ] Add auth checking\n- [ ] Add ACLs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-pro%2Fkoa2-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs-pro%2Fkoa2-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-pro%2Fkoa2-starter/lists"}