Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clone this wiki locally
I've been playing with Node.js for several days and started to ask myself how an application for real environments should be... This is how I got here, wanting to clarify common things/problems such as: i18n, MVC, DAO, SOA, REST, testing (xUnit style), documentation (Javadoc style), etc.
I hope this "conventions" (set of technologies and practices) help other programmers facing similar problems. I'm planning to add other examples including NoSQL and ORM, but right now only developed a simple app with Express as web framework and SQLite as SQL database engine. The app has CRUD operations for a user entity and was developed the way I think web apps should be programmed this days:
- Presentation: HTML and CSS (inside CSS files). The HTML files should contain only static data and controls, NO format and NO logic.
- Business logic interface: REST services. Presentation logic call REST services (using jQuery), which produces JSON data.
- Business logic: Logic or service classes, separated from REST facades. This way your app can scale and be maintained easily. SOA style, decoupling!!!
- Data logic: DAO classes. If you include an ORM, DAO should exist also for abstraction.
Following details for the sqlite example:
- [How to run it](wiki/How to run it)
- How I made it
This should be put in other place...
- UnitTesting. Not added so far, but I'm going to use QUnit. This is the unit testing tool used by jQuery.
- ORM. Not added so far, but I'm going to use Node-ORM.
- I used jQuery, jQuery Template (which is deprecated but still cannot find something better), and jQuery UI. @jesussjara recommend me to use Tempo instead of jQuery Template, I'll try it soon ;-)
- The views are using styles from jQuery UI Theme Lightness. The jQuery UI CSS Framework. Comments on selectors...
- Deploy. Using Capistrano...
$ sudo aptitude install rubygems1.9.1 rodolfo@munra:$ gem1.9.1 -v 1.3.7 rodolfo@munra:~$ gem1.9.1 install capistrano