基于Node.js,Express和Teddy的MVC Web框架:Roosevelt

jopen 11年前發布 | 32K 次閱讀 Roosevelt Node.js 開發

Roosevelt是一個基于Node.js,Express和Teddy的MVC Web框架,使用 Teddy 作為 HTML 模板引擎,使用 Less 作為 CSS 預處理器。Roosevelt被設計成抽象所有建立一個典型應用程序快速的必要模板,設置健全的默認值與替代機制,并為您的應用程序提供了一個統一的MVC結構。

依賴說明

  • express - 一個最小的,靈活的Node.js的Web應用程序框架
  • teddy - 一個易于閱讀的,基于HTML的,大多是邏輯較少的DOM模板引擎
  • less-middleware - Connect middleware for LESS compiling
  • formidable - a Node.js module for parsing form data, especially file uploads
  • wrench - used by the CLI tool to help you create your sample app

Controller files are just standard Express routes. For example:

module.exports = function(app) { // app is the Express app created by Roosevelt

  // standard Express route
  app.get('/about', function(req, res) {

    // use Roosevelt to load a data model
    var model = app.get('model')('about');

    // render a Teddy template and pass it the model
    res.render('about', model);
  });
};


 

項目主頁:http://www.baiduhome.net/lib/view/home/1386293354361

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!