This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'), | |
_request = require('request'), | |
extend = require('extend'); | |
function merge(obj1, obj2) { | |
// the resulting object will have all (deep) properties of obj1 and obj2 | |
// obj2 has precendence over obj1 | |
return extend(true, {}, obj1, obj2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = null, | |
server = null; | |
initialise() | |
.then(function (_db) { | |
db = _db | |
return createServer(db); | |
}) | |
.then(function (_server) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userRouter = express.Router(), | |
projectsRouter = express.Router(); | |
userRouter.use('/:userId', function (req, res, next) { | |
req.user = fetchAndValidate(req.param('userId')); | |
next(); | |
}); | |
projectsRouter.use('/', function (req, res, next) { | |
res.send(fetchProjects(req.user)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build . | |
Uploading context 51.71 kB | |
Uploading context | |
Step 0 : FROM woorank/base | |
---> 91ab7b695a0c | |
Step 1 : ADD . /strongops-docker | |
---> 50bb3ccb9170 | |
Step 2 : RUN cd /strongops-docker && npm install | |
---> Running in b5ae9b045121 | |
npm WARN package.json strongops-docker@0.0.0 No repository field. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var reportRoute = function (req, res) { | |
// Validate input parameters | |
req.assert("userId").notEmpty().isInt(); | |
req.assert("url").notEmpty().isUrl(); | |
req.assert("reportId").notEmpty().isInt(); | |
// Validate input | |
var errors = req.validationErrors(); | |
// Handle errors |
NewerOlder