Git Product home page Git Product logo

monorail.js's Introduction

endorse

Monorail.js - Ultra lightweight MVC Framework for Node.js

TLDR; Monorail.js will never force you, and uses only what you need.
Monorail.js will never force you to install anything not needed for your project.
The goal is to use what you need.
Anything other than creating a project will always be optional.

Monorail.js Logo

npm install Monorail.js

Or start a project right now with Railing.sh

./railing.sh Project_Name

No configuration required.
Zero Touch Configuration to get you up and running.

$ ./monorail.js new project example
Creating Project example
Making directory example
Making directory example/static
Making directory example/static/img
Making directory example/static/js
Making directory example/static/css
Making directory example/themes
Making directory example/themes/classic
Making directory example/themes/classic/img
Making directory example/themes/classic/js
Making directory example/themes/classic/css
Making directory example/models
Making directory example/views
Making file example/monorail.project
Making file example/routes.js
Making file example/redis.config
Making file example/themes/classic/classic.html
Making file example/themes/classic/css/classic.css
Copying libs...

$ cd example

$ cat monorail.project
name : example
theme : classic
express_port : 8123

$ ../monorail.js start server
Starting Redis...
Redis Running on Process 3822
Starting Express
Express Running on Process 3825

Congratulations. You're DONE!

Example

Lets install Mootools and RightJS

[user@machine tmp]$ ls 
Example  README.md  lib  monorail.js  monorail.js-small.png  monorail.js.png  package.json

[user@machine tmp]$ cd Example/

[user@machine Example]$ ../monorail.js
install [mootools | rightjs | jquery | dojo | prototype ] ; Install JS Framework in this project
start server ; Start project Redis & Express server
new project [project_name] ; Creates project
new page [page_name] ; Creates new project page

[user@machine Example]$ ../monorail.js install mootools
[user@machine Example]$ ../monorail.js install rightjs 
[user@machine Example]$ tree static/
static/
|-- css
|-- img
`-- js
	  |-- mootools-core-1.4.5-full-compat.js
	  `-- right-2.3.1.js

3 directories, 2 files

Make a new page

$ ../monorail.js new page user

Lets view our user view

$ cat views/user.xml 
<#CODE#>html_body = 'This code block takes 100% node.js code.';</#CODE#>

Change it to this

<#CODE#>html_body = 'Viewing profile of '+username;</#CODE#>

Lets view our user model

$ cat models/user.js 

var nohm = require('../lib/nohm').Nohm;
var redis = require('../lib/nohm/node_modules/redis');
var client = redis.createClient();

nohm.setClient(client);
nohm.model('user',{});

Lets add a controller to the bottom of route.js

app.get('/user/:name', function(req, res) {
  user = req.params.name;
  view = loadView('user',{ username: user });
  page = railed('Viewing User - '+user, view);
  res.send(page);
});

app.listen(express_port);

Lets start the server up and point our browser to http://localhost:8123/user/any_name_here

$ ../monorail.js start server
Starting Redis...
Redis Running on Process 3822
Starting Express
Express Running on Process 3825

There's more examples in the wiki :)

Documentation

Monorail.js

https://github.com/runexec/Monorail.js/wiki

JS Frameworks

http://docs.jquery.com/Main_Page
http://mootools.net/docs/core
http://rightjs.org/docs
http://api.prototypejs.org/
http://dojotoolkit.org/documentation/

Redis ORM

http://maritz.github.com/nohm/

Redis

https://github.com/mranney/node_redis

Express Routing

http://expressjs.com/guide.html#http-methods
http://expressjs.com/guide.html#routing
http://expressjs.com/guide.html#passing-route%20control
http://expressjs.com/guide.html#route-middleware
http://expressjs.com/guide.html#route-param%20pre-conditions

Compatibility

It has currently only been tested on unix, but should work on windows with little or no changes.

Built and tested with node v0.6.13
nohm ORM vs 0.9.0
express 2.58

TODO

Add easy escape/unescape functions
Theme/Template documentation
More Wiki-Examples coming very very soon.
Heavy Bug Testing

License

MIT License Copyright (c) 2012 Ryan Kelker and individual contributors.

monorail.js's People

Contributors

runexec avatar poincare avatar

Stargazers

fRui Apps avatar

Watchers

fRui Apps avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.