{"id":19450524,"url":"https://github.com/ymc-github/blog-api-with-koa","last_synced_at":"2026-05-04T15:40:34.606Z","repository":{"id":95798612,"uuid":"228971966","full_name":"YMC-GitHub/blog-api-with-koa","owner":"YMC-GitHub","description":"my blog api","archived":false,"fork":false,"pushed_at":"2020-09-04T01:34:09.000Z","size":115,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T23:46:12.753Z","etag":null,"topics":["api","blog","docker","koa","mongoose"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YMC-GitHub.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":"2019-12-19T04:02:45.000Z","updated_at":"2020-01-13T01:22:47.000Z","dependencies_parsed_at":"2023-04-08T05:02:01.461Z","dependency_job_id":null,"html_url":"https://github.com/YMC-GitHub/blog-api-with-koa","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMC-GitHub%2Fblog-api-with-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMC-GitHub%2Fblog-api-with-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMC-GitHub%2Fblog-api-with-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMC-GitHub%2Fblog-api-with-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YMC-GitHub","download_url":"https://codeload.github.com/YMC-GitHub/blog-api-with-koa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240637738,"owners_count":19833180,"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":["api","blog","docker","koa","mongoose"],"created_at":"2024-11-10T16:38:07.377Z","updated_at":"2025-11-18T15:03:56.678Z","avatar_url":"https://github.com/YMC-GitHub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blog-api\n\n## desc\n\nmy blog api with nodejs\n\n## qucik start\n\n```sh\n# Install dependencies\nnpm install\n\n# Start the api server(dev)\nnpm run start\n\n# Start the api server(pro)\nnpm run  pm2\n#or\nnpm run  koa\n#...\n\n```\n\n## add admin user\n\nAdd admin http://localhost:4000/api/backend\n\nAfter the success of the administrator to add, will automatically generate the admin.\n\nLock file locking, if you need to continue to add, please just delete the file\n\nnote:get more details on [api-docs(todos)]().\n\n\n## the project construtor\n\n```\n|--README.md #read me before\n|--app.js #the app index file\n|--bin #run the app index file\n| |--run\n| |--www\n|--license\n|--package.json\n|--server\n| |--api #some api handle files\n| | |--backend-article.js\n| | |--backend-category.js\n| | |--backend-user.js\n| | |--frontend-article.js\n| | |--frontend-comment.js\n| | |--frontend-like.js\n| | |--frontend-user.js\n| | |--general.js\n| |--config  #some config for cunstom app\n| | |--index.js\n| | |--mpapp.js\n| | |--secret.js\n| |--middlewares #some custom middlewares files\n| | |--admin.js\n| | |--check.js\n| | |--return.js\n| | |--user.js\n| |--models #some data model files\n| | |--admin.js\n| | |--article.js\n| | |--category.js\n| | |--comment.js\n| | |--user.js\n| |--mongoose.js # connect database\n| |--routes # map the url path to handle files/functions with router\n| | |--backend.js\n| | |--frontend.js\n| | |--index.js\n| |--utils #some useful tool\n|--views #some views\n|--admin-add.ejs\n|--favicon.ico\n```\n\n\n## the lifecricle of the app\n\n- map the url path to handle files/functions with route\n- connect database\n\n```\nreq url-\u003eroute-\u003emodel-\u003eview-\u003eres uri\n```\n\n## some custom koa middleware\n\nadmin:\n```\n// ================ admin ================\n// this is a custom koa middleware admin\n// ================ admin ================\n// task:\n// check if user is admin:\n// 01.need to login first\n// 02.need to check the user\n// if true,goto next middleware\n```\n\ncheck:\n```\n// ================ check ================\n// this is a custom koa middleware check\n// ================ check ================\n// task:\n// verify the token with some config\n```\n\nuser:\n```\n// ================ user ================\n// this is a custom koa middleware user\n// ================ user ================\n// task:\n// check if user is user:\n// 01.need to login first\n// 02.need to check the user\n// if true,goto next middleware\n```\n\n\nreturn:\n```\n// ================ return ================\n// this is a custom koa middleware return\n// ================ return ================\n// task:\n// bind error,success function to ctx to uniform the return result\n// and goto next middleware\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymc-github%2Fblog-api-with-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymc-github%2Fblog-api-with-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymc-github%2Fblog-api-with-koa/lists"}