Commit d9801661 authored by project's avatar project

--no commit message

--no commit message
parent 70158fb4
var ctx = require('../context');
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var ConnCtx = ctx.getLib('lib/conn/connection-context');
var API_PORT = 19980;
module.exports.create = function(cfg)
{
var api = new ControllerAPI(cfg);
return api;
}
function ControllerAPI(cfg)
{
this.config = cfg;
this.conn = ConnCtx.create(this.config);
this.mem = this.conn.getMemstore()
}
ControllerAPI.prototype.start = function()
{
console.log('Starting Controller API ...\n');
this._http_start();
}
ControllerAPI.prototype._http_start = function()
{
var self = this;
app.use(bodyParser.json({limit: '128mb'}));
app.use(bodyParser.urlencoded({
extended: true
}));
// var context = ctx.getLib('lib/ws/http-context');
// app.use(context.middleware({
// 'httpacl' : self.httpacl,
// 'jobcaller' : self.jobcaller
// }));
app.use(require('./ws'));
app.listen(API_PORT, function () {
console.log('Ctl-API:HTTP START\t\t[OK]');
});
}
var express = require('express')
, router = express.Router()
router.use('/v1',require('./v1'));
module.exports = router;
var express = require('express');
var router = express.Router();
router.use('/jobs',require('./service-jobs'));
module.exports = router;
var ctx = require('../../../context');
var express = require('express');
var router = express.Router();
var cfg = ctx.config;
var response = ctx.getLib('lib/ws/response');
var request = ctx.getLib('lib/ws/request');
router.get('/',function (req, res) {
var reqHelper = request.create(req);
var respHelper = response.create(res);
var jid = req.params.id;
//get_object(reqHelper,respHelper,jid);
respHelper.responseOK({'status':'OK'});
});
module.exports = router;
......@@ -12,6 +12,7 @@ var QueueCaller = ctx.getLib('lib/amqp/queuecaller');
var EvenSub = ctx.getLib('lib/amqp/event-sub');
const JOBCHANEL = 'bs_job_cmd';
const API_PORT = 19180;
module.exports.create = function(cfg)
{
......@@ -31,16 +32,14 @@ function HTTPListener(cfg)
HTTPListener.prototype.start = function()
{
console.log('Starting HTTP Listener ...\n');
this.http_start();
this._http_start();
this._controller_start();
}
HTTPListener.prototype.http_start = function()
HTTPListener.prototype._http_start = function()
{
var self = this;
var API_PORT = 19180;
this.httpacl.update(function(err){
if(!err){
console.log('WWW:ACL Update\t\t[OK]');
......
module.exports.middleware = function(ctx){
var funcCtx = function (req, res, next) {
req.context = ctx;
next();
}
return funcCtx;
}
var ctx = require('./context');
var ControllerAPI = ctx.getLib('coreservice/controller-api');
var api = ControllerAPI.create(ctx.config);
api.start();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment