blob: 4e0566c98416df2544c283f36a88c4c2cdbfde13 [file] [log] [blame]
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var port = process.env.VCAP_APP_PORT || 8080,
express = require('express'),
app = express(),
expressWs = require('express-ws')(app),
bodyParser = require('body-parser'),
invoker = require('./lib/invoker'),
db = require('./lib/db');
db.init(function() {
app.use(bodyParser.json());
var router = express.Router();
router.ws('/client/register', db.registerDebugClient);
app.use('/ws', router);
app.get('/ping', function(req, res) { res.send("OK") });
app.post('/invoke/begin', invoker.invoke);
app.get('/invoke/status/:activationId', invoker.status);
app.listen(port, function() {
console.log("OWDBG Broker Ready");
});
});