Shinjs
Shinjs is a MVC Node framework built on top of Express
Getting started
Installation
Requires Nodejs version > 4.5
$ npm install shinjs -g$ shinjs new MyNewApp$ cd MyNewApp$ shinjs start
Now go to your browser and access the host and port
127.0.0.1:1337
Features!
- Routing features that can overwrite controllers
- Bind customized parameters to your controller and can be accessed in the res.locals
- Render front-end dependencies using bower
Controllers
You can generate controller using the command:
$ shinjs generate Main -c
The generated controller is located in ./app/controllers/Main.js
"use strict"moduleexports = //localhost:1337/main "index":'GET'{ // app/views/home.html res }title:'My Home Page'name:'home' //localhost:1337/main/hello "hello":'GET'{ res }title:'A hello world page'name:'hello_world'
Models
Shinjs uses the popular ORM Sequelize to provide models in our app ./app/models/Users.js
"use strict"module { var Users = sequelize return Users}
Now to access the model
"users":'GET'{ $modelsusers; }title:'My Home Page'name:'home'
API
IO Use Socket io Instance
Models Database Models that is generated by Sequelize Access using:
$models
Helpers Helpers are functions that can be shared between controllers and promote reusable and cleaner code. The api can be called and allows access to built-in and custom helpers.
var numbers = $helperssampleHelperconsole // 10
App Express app instance Locals:
variables | type | value |
---|---|---|
params | object | [name, title] |
site_url | string | http://[hostname:port] |
form | object[function] | generated form |
assets | object [function] | generated assets |
Config
These are app settings ranging from database to web configurations. You can override these config using .env file if provided.
Config | Description | values |
---|---|---|
database | Contains configuration for connecting to databse | [host, port, name, username, password ] |
assets | Assets overrides and for defining themes | [bower_url, assets_url, overrides (see wiredep), themes ] |
web | App hostname and port configurations. Session key and storage | [title, host, port, proxy, static_dir, timezone, session, session_secret, session_store] |
views | Extension settings (.ejs, .html) | [engine, ext] |
Development
Feel free to contribute by forking Shinjs. Current development status is alpha.
Roadmap
- Built-in Task manager that can schedule and queue task (storage: database or memory)
- Limit objects passed to the global variable $
- API manager dashboard
- API permissions
Todos
- Write tests
- Enhance API helpers and extensions
- Add CORS to improve form restrictions
- Allow custom plugin and more hooks
License
MIT