An OpenShift app that consumes CPU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

37 lines
841 B

var express = require("express");
var app = express();
var router = express.Router();
var port = 8080;
router.use(function (req,res,next) {
next();
console.log("%s %s => %i", req.method, req.originalUrl, res.statusCode);
});
router.get("/",function(req,res){
var now = new Date().getTime();
while(new Date().getTime() < now + 1000) {
// do nothing
}
var response = {
"status": "ok"
};
res.type('application/json')
.header("Connection", "close")
.header('Cache-Control', 'private, no-cache, no-store, must-revalidate')
.header('Expires', '-1')
.header('Pragma', 'no-cache')
.send(JSON.stringify(response))
.end();
});
app.use("/",router);
app.use("*",function(req,res){
res.status(404).send("Not found");
});
app.listen(port,function(){
console.log("Live at Port %i", port);
});