{"id":19982141,"url":"https://github.com/code2life/koa-generator","last_synced_at":"2026-04-10T02:51:21.069Z","repository":{"id":98207448,"uuid":"114582968","full_name":"Code2Life/koa-generator","owner":"Code2Life","description":"A flexible code generator for koa2","archived":false,"fork":false,"pushed_at":"2021-01-20T07:24:22.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T06:09:31.150Z","etag":null,"topics":["ejs","koa-generator","koa2","mongodb","mysql","pug","restful-api","sequelize"],"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/Code2Life.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":"2017-12-18T01:35:03.000Z","updated_at":"2021-01-20T07:24:24.000Z","dependencies_parsed_at":"2023-05-18T15:16:19.134Z","dependency_job_id":null,"html_url":"https://github.com/Code2Life/koa-generator","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"5f5954e64804f61c1503d5be5d375286cdf249ef"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code2Life%2Fkoa-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code2Life%2Fkoa-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code2Life%2Fkoa-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code2Life%2Fkoa-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Code2Life","download_url":"https://codeload.github.com/Code2Life/koa-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241418363,"owners_count":19959736,"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":["ejs","koa-generator","koa2","mongodb","mysql","pug","restful-api","sequelize"],"created_at":"2024-11-13T04:09:21.648Z","updated_at":"2025-10-15T00:22:32.058Z","avatar_url":"https://github.com/Code2Life.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koa-generator-pro\n\nA flexible code generator for koa2. Koa-generator-pro can generate a MVC node.js project with koa@2.x+, mongodb or mysql data access, ejs or pug template engine, mocha + should.js unit test examples and so on.\n\n# Install \n```\nnpm install koa-generator-pro -g\n```\n\n## Basic Usages\n```\n/* open command line or shell in a empty directory */\n\n/* lookup usage and default options */\nkoa2 --help \n\n/* create a project at port 3000, pug + koa2 + sequelize + mysql + mocha ... */\nkoa2 -p 3000 -d mysql -t pug -u true\n\n/* create a resutful api project with mongodb */\nkoa2 -d mongodb\n```\n\n## Options\n1. -p --port : default 3000, any number between 0~65535\n2. -d --database: default none, support mysql and mongodb currently\n3. -t --template: default none, support ejs and jade/pug\n4. -u --unit-test: default true, set false if you don't want to write unit test\n5. -a --addons: default \"\", define your custom plugins by set this option\n\n## Notice\n\nGenerated project can only run by node which version is above 7.6.0\n\n## Plugin example\n```\n# add-custom-util-plugin.js\n\nconst fs = require('fs');\nconst path = require('path');\n/**\n * @param {pathStr} generator work directory, equals to process.cwd()\n * @param {root} instance of KoaBuilder, \n *               options can be found in root, like root.port\n * @param {package} the object would be wrote to package.json\n */\nasync function build(pathStr, root, package) {\n  //await some asynchronizaed business\n  let codeToWrite = '... function(){} ... module.export = ...';\n  let writePath = path.resolve(pathStr, 'common/my-util.js');\n  fs.writeFileSync(writePath, codeToWrite);\n}\n\n/* save this file in ../plugin \u0026 use like following */\n// koa2 -p 3001 -a ../plugin/add-custom-util-plugin.js\n```\n\n## License\nMIT License\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode2life%2Fkoa-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode2life%2Fkoa-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode2life%2Fkoa-generator/lists"}