mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
changing rest port
This commit is contained in:
@@ -151,14 +151,14 @@ Districts that are unwanted can be blacklisted here.
|
|||||||
This makes sense for provider that only offer limited filter functions like Kalaydo/Ebay.
|
This makes sense for provider that only offer limited filter functions like Kalaydo/Ebay.
|
||||||
|
|
||||||
# API
|
# API
|
||||||
While Fredy is running, you can make use of the rest api provided on port `9988` to get information about the current status of Fredy.
|
While Fredy is running, you can make use of the rest api provided on port `9998` to get information about the current status of Fredy.
|
||||||
#### http://localhost:9988/
|
#### http://localhost:9998/
|
||||||
Gives you an overview of running search jobs, their included enabled provider, last execution and the number of listings, found by each provider.
|
Gives you an overview of running search jobs, their included enabled provider, last execution and the number of listings, found by each provider.
|
||||||
|
|
||||||
#### http://localhost:9988/ping
|
#### http://localhost:9998/ping
|
||||||
Should you ever need some health checks, this returns pong ;)
|
Should you ever need some health checks, this returns pong ;)
|
||||||
|
|
||||||
#### http://localhost:9988/jobs/:name
|
#### http://localhost:9998/jobs/:name
|
||||||
Returns specific information about the job with the given name or `404` if the job could not be found.
|
Returns specific information about the job with the given name or `404` if the job could not be found.
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const config = require('../../conf/config');
|
const config = require('../../conf/config');
|
||||||
const { getLastJobExecution, getLastProviderExecution, getTotalNumberOfListings } = require('../services/store');
|
const { getLastJobExecution, getLastProviderExecution, getTotalNumberOfListings } = require('../services/store');
|
||||||
const PORT = 9988;
|
const PORT = 9908;
|
||||||
const service = require('restana')();
|
const service = require('restana')();
|
||||||
service.use(bodyParser.json());
|
service.use(bodyParser.json());
|
||||||
|
|
||||||
service.get('/', async (req, res) => {
|
service.get('/', async (req, res) => {
|
||||||
const result = {};
|
const result = {};
|
||||||
Object.keys(config.jobs).forEach(job => {
|
Object.keys(config.jobs).forEach((job) => {
|
||||||
result[job] = {
|
result[job] = {
|
||||||
lastExecution: getLastJobExecution(job),
|
lastExecution: getLastJobExecution(job),
|
||||||
enabledProvider: Object.keys(config.jobs[job].provider)
|
enabledProvider: Object.keys(config.jobs[job].provider)
|
||||||
.filter(providerKey => config.jobs[job].provider[providerKey].enabled)
|
.filter((providerKey) => config.jobs[job].provider[providerKey].enabled)
|
||||||
.map(providerKey => {
|
.map((providerKey) => {
|
||||||
return {
|
return {
|
||||||
name: providerKey,
|
name: providerKey,
|
||||||
lastExecution: getLastProviderExecution(job, providerKey),
|
lastExecution: getLastProviderExecution(job, providerKey),
|
||||||
totalFindings: getTotalNumberOfListings(job, providerKey)
|
totalFindings: getTotalNumberOfListings(job, providerKey),
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
res.body = result;
|
res.body = result;
|
||||||
@@ -35,22 +35,22 @@ service.get('/jobs/:name', async (req, res) => {
|
|||||||
res.body = {
|
res.body = {
|
||||||
lastExecution: getLastJobExecution(jobKey),
|
lastExecution: getLastJobExecution(jobKey),
|
||||||
enabledProvider: Object.keys(config.jobs[jobKey].provider)
|
enabledProvider: Object.keys(config.jobs[jobKey].provider)
|
||||||
.filter(providerKey => config.jobs[jobKey].provider[providerKey].enabled)
|
.filter((providerKey) => config.jobs[jobKey].provider[providerKey].enabled)
|
||||||
.map(providerKey => {
|
.map((providerKey) => {
|
||||||
return {
|
return {
|
||||||
name: providerKey,
|
name: providerKey,
|
||||||
url: config.jobs[jobKey].provider[providerKey].url,
|
url: config.jobs[jobKey].provider[providerKey].url,
|
||||||
lastExecution: getLastProviderExecution(jobKey, providerKey),
|
lastExecution: getLastProviderExecution(jobKey, providerKey),
|
||||||
totalFindings: getTotalNumberOfListings(jobKey, providerKey)
|
totalFindings: getTotalNumberOfListings(jobKey, providerKey),
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
res.send();
|
res.send();
|
||||||
});
|
});
|
||||||
|
|
||||||
service.get('/ping', function(req, res) {
|
service.get('/ping', function (req, res) {
|
||||||
res.body = {
|
res.body = {
|
||||||
pong: 'pong'
|
pong: 'pong',
|
||||||
};
|
};
|
||||||
res.send();
|
res.send();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user