npm init
npm install --save base2
create app.js
var app = require('base2')({
// debug: true,
root:__dirname
})
app.get('/', function(req, res){
res.json({hello: 'world'});
})
app.start(3029);
run
npm run 1
open in browser
install express
npm i --save express
create app.js
var app = require('base2')({
// debug: true,
root:__dirname,
"routes": "routes",
});
app.start(3029);
create routes folder
routes/index.js
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.send('respond with a routes /');
});
module.exports = router;
routes/users.js
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource /users');
});
module.exports = router;
run
npm run 2
open in browser
duplicate mount-routes with views-jade
install jade
npm i --save jade
modify app.js
var app = require('base2')({
// debug: true,
root:__dirname,
"routes": "routes",
"views" : "views"
});
app.start(3029);
only add views option
run
npm run 3
var app = require('base2')({
// debug: true,
root:__dirname,
"public": "public",
})
app.start(3029);
only add public option
run
npm run 4
with views
run
npm run 5
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- v1.0.0 初始化版本
- write by
i5ting
i5ting@126.com
如有建议或意见,请在issue提问或邮件
this repo is released under the MIT License.