1.0.4-alpha • Published 7 years ago

expring v1.0.4-alpha

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

expring

Example

SimpleService.js:

let expring = require('expring');

class SimpleService extends expring.Service {
    constructor() {
        super('SimpleService');
    }
}

let simpleService = new SimpleService();

simpleService.addMethods([{
    name: 'example',
    fn: () => 'Hello, Expring!'
}])

module.exports = simpleService;

SimpleController.js:

let expring = require('expring');

let SimpleService = require('SimpleService.js');

class SimpleController extends expring.Controller {
    constructor() {
        super('SimpleController');
    }
}

let simpleController = new SimpleController();
simpleController.setRequests([
    {
        url: '/',
        type: 'GET',
        fn: (req, res) => {
            res.send(SimpleService.example);
        }
    }
]);

module.exports = simpleController;

main.js:

let expring = require('expring');

let app = expring();

let SimpleController = require('SimpleController.js');
SimpleController.init(app);

app.listen(9001);

You can use built-in Services:

let LogService = expring.Services.LogService; // uses log4js

// TODO more built-in Services
1.0.4-alpha

7 years ago

1.0.3-alpha

7 years ago

1.0.2-alpha

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago