alajs
nodeJs mvc framework
Last updated 4 years ago by leeke .
MIT License · Repository · Original npm · Tarball
$ cnpm install alajs 
SYNC missed versions from official npm registry.

ALAJS Get Started

ALAJS is a simple mvc framework based on koa.Thank you very much, you are a great middle framework!

###1. Install

1. npm install alajs --save          
2. npm -g install node-dev     

###2. Create app.js file and require alajs

var alajs = require('alajs');

###3. Define an App

App = alajs({           /*please set the App to gobal*/
	name 		: 	'ALABLOG',
	databases	: 	{
		default:  'mysql:root@localhost/test',
		log 		: 'mongodb://localhost/test'
	},
	models 		: 	['/share/models']
});

###4. Define a module

App.define.module({
	name 			:   'root',
	url 			: 	'/',
	path 			: 	'/app',
	controllers		: 	['/controllers','/otherCtrls'],
	staticResources : 	'/static',
})

###5. Set default module

App.define.defaultModule('root');

###6. Define a server

var server = App.define.server({port:3000});

###7. Load App to server

server.loader(App);

###8. Startup server

server.bootstrap();

###9. Create a welcome.js file in controllers folder and define a controller

var welcome = App.define.controller({name:'welcome',url:'/welcome'})

###10. Define an action function for response

welcome('you',function *(next){

	this.body = 'You are welcome!'

})

###11. Start this app

node-dev --debug --harmony app.js

###12. Visit http://localhost:3000/welcome/you

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 39
Dependencies (23)
Dev Dependencies (12)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |