Paloma 是一个类 Angular 的 Node.js MVC 框架。
特性:
依赖注入
基于 Koa@2
例子:
'use strict';
const Paloma = require('paloma');
const app = new Paloma();
app.controller('indexCtrl', Function (ctx, next, indexServICE) {
ctx.body = `Hello, ${indexService.getName()}`;
});
app.service('indexService', function () {
this.getName = function () {
return 'paloma';
};
});
app.route({
method: 'GET',
path: '/',
controller: 'indexCtrl'
});
app.listen(3000);