This is a simple web framework based on Express and inspired from Sails.js. Under GPL v2 licence.
It uses Sequelize as ORM and Schema Inspector for data validation/sanitition. As it is based on ExpressJS, controllers are compatible with Connect middleware system, so migration from an ExpressJS project to Light API is quite simple.
- Create a Node application following this structure:
main_folder
├─┬ api
│ ├─ controllers
│ └─ views
└── config
- In the
controllers
folder, create aIndexController.js
node module. It will exports a object associating an action name to a function like this :
module.exports = {
index: function (req, res) {
res.render("index.ejs", {name: req.params.name}
}
}
- In the
views
folder, create aindex.ejs
template, and type something like :
Hello <%= name %> !
- Finally, in the
config
folder, add arouter.js
node module, which will define the routing of your application. The system is pretty much like Sails.js router (see http://sailsjs.org/#!documentation/routes), without resourseful routing.
module.exports = {
"/:name": "IndexController:index"
}
-
Create an
app.js
node module in the main folder and simply add that following line :require('lightapi').run();
-
Launch the app :
node app
and go to http://localhost:1337/World and magic will happend !
Documentation will be completed later, the roadmap a little bit before. For some examples of app build using Light API, see this repo, and have a look at the differents branches.