Git Product home page Git Product logo

lightapi's Introduction

Light API

Light API Logo

This is a simple web framework based on Express and inspired from Sails.js. Under GPL v2 licence.

Build Status NPM version Dependency Status Code Climate

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.

Quick start

  • Create a Node application following this structure:
  main_folder
  ├─┬ api
  │ ├─ controllers
  │ └─ views
  └── config
  • In the controllers folder, create a IndexController.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 a index.ejs template, and type something like :
  Hello <%= name %> !
  • Finally, in the config folder, add a router.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.

lightapi's People

Contributors

palra avatar

Watchers

 avatar  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.