Browse Source

Phase III

master
Yutsuo 7 years ago
parent
commit
4ef5ae6994
  1. 11
      node/app.js
  2. 4
      node/password.json

11
node/app.js

@ -84,6 +84,13 @@ app.get('/metrics2', function(req, res){
res.end(); res.end();
}) })
app.use(express.json());
app.post('/token', function(request, response){
console.log(request.body); // your JSON
response.send(request.body); // echo the result back
});
app.get('/', (req, res)=>{ app.get('/', (req, res)=>{
res.json([{message:'yes, your nodejs app is really running'}]); res.json([{message:'yes, your nodejs app is really running'}]);
counter++; // for prometheus invocation_count metric counter++; // for prometheus invocation_count metric
@ -109,7 +116,9 @@ app.post('/info/add/:name', function(req, res){
res.send('color ' + req.params.name + ' added to database'); res.send('color ' + req.params.name + ' added to database');
}); });
// app.get('/token/:user&:password', function(req, res){
// res.json(req.params);
// })
connectWithRetry(); connectWithRetry();

4
node/password.json

@ -0,0 +1,4 @@
{
"user": "user1",
"password": "pass1"
}
Loading…
Cancel
Save