npm install -g koa-generator
koa2 <项目名>
npm start (bin/www 文件有相关配置,如端口地址)
app.js:
var router = require('koa-router')();
var index = require('./routes/index'); //子路由1
var users = require('./routes/users'); //子路由2
app.use(index.routes(), index.allowedMethods()) //安装子路由1
app.use(users.routes(), users.allowedMethods()) //安装子路由2
var router = require('koa-router')();
router.prefix('/users')
router.get('/', function *(next) {
yield this.render('index', {
title: 'Hello World Koa!'
});
});
module.exports = router;
git init
git add .
git commit -m ' '
git remote add origin [url]
git push origin master:master
清除缓存
git rm -r --cached .