hhajhh 发表于 2015-11-28 18:49:12

Paloma 0.2.0 发布,Node.js MVC 框架

'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);
页: [1]
查看完整版本: Paloma 0.2.0 发布,Node.js MVC 框架