-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (20 loc) · 1023 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const express = require('express');
const app = express();
const port = 8090;
const additionalParams = '?tree=jobs[name,color,healthReport[description,score,iconUrl]]';
const qaJenkinsUrl = `http://qajenkins3.ptv.com:8080/view/Devball/api/json${additionalParams}`; //move to config?
const mtpJenkinsUrl = `http://10.216.99.56:8080/view/Devball/api/json${additionalParams}`;
const qouteApi = 'https://geek-jokes.sameerkumar.website/api'
const fetcher = require(`${process.cwd()}/service/fetcher`);
const sorter = require(`${process.cwd()}/service/sorter`);
const decorator = require(`${process.cwd()}/service/decorator`);
app.set('view engine', 'pug');
app.use(express.static(require('path').join(__dirname, 'public')));
app.get('/', (req, res) => {
fetcher([qaJenkinsUrl, mtpJenkinsUrl])
.then(response => sorter(response))
.then(response => decorator(response))
.then(jobs => res.render('index', {jobs}))
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`));