expring
v1.0.4-alpha
Published
Express superstructure
Downloads
3
Readme
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