A Simple MVC Setup In Node.JS
来源:互联网 发布:线隔电脑编程教学 编辑:程序博客网 时间:2024/05/19 16:20
文章来源:http://www.travisglines.com/
I’m sure many of you have heard about the new server side javascript project called node.js. I’ve been using myself to build full stack dynamic websites and find it a very nice environment to create a dynamic website. When I first started out I had no idea what sort of way one should create an MVC style framework with node or what modules would help me to achieve the model, view, controller ideal. Heres my stack:
- Node.js (http://nodejs.org/) of course
- NPM (http://npmjs.org/) to easily install packages for node.
- Express (http://expressjs.com/) – a very nice web development framework built on connect (allows “controllers”)
- Mongoose (http://mongoosejs.com/) – a solid orm for mongodb in node.js that just released a much improved version (allows “models”)
- Jade (http://jade-lang.com/) – a template engine for node that allows some cool shorthand (allows “views”)
- Other tools were used of course but those were the essentials.
The application directory looks something like this:
Inside the application I instantiate express, include my mongoose models and include my routes/controllers from the controllers directory at the bottom. Inside the controllers I call res.render to render the jade views and it all works very nicely. If people would like me to elaborate on this more let me know.
A huge shoutout and thank you to the LearnBoost guys (TJ Holowaychuk, Guillermo Rauch, Aaron Heckmann, and many more that aren’t associated with LearnBoost) who’ve made Node.js web application development a breeze.
- A Simple MVC Setup In Node.JS
- A Simple Web Service In Node.Js + CouchDB
- Implement a simple iterator using javascript (node.js)
- Simple Sync is a simple sync function-wrapper for node js, based on fibers module.
- Tomcat setup in windows(simple version)
- [Setup] FLTK - A simple C++ GUI Library
- Node.js Setup:This may indicate a problem with this package. The error code is 2503.
- Basic RPCs in Node.js with a Java Backend
- Node.js in ubuntu
- RPC in node.js
- Setup a Subversion Server in 4 Minutes
- Setup a Subversion server in three minutes
- [KAFKA-1724]Errors after reboot in single node setup
- Delete Node in a BST
- Delete Node in a BST
- Delete Node in a BST
- Delete Node In A LinkedList
- leetcode450Delete Node in a BST
- Keep Writing
- 使用 rsync 从windows到Linux同步大量小文件
- VBA读取Excel和CSV
- mvc 路由简单配置(一)
- apache和nginx互切同时都支持fastcgi
- A Simple MVC Setup In Node.JS
- php中一些知识
- CentOS 5 中OpenSSL和OpenSSH升级
- Video4Linux2 part 2: registration and open()
- Apache Nginx lighttpd HAProx Litespeed 缓冲原理解析fastcgi性能
- PHP运行出现Notice : Use of undefined constant 的完美解决方案
- 关于Android的Orientation问题
- 八皇后问题算法(回溯与递归算法)
- Unable to open Web project 'ProjectName'. An HTTP error occurred. The server ......