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.
|
||||
|
||||
# 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.
|
||||
#### http://localhost:9988/
|
||||
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:9998/
|
||||
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 ;)
|
||||
|
||||
#### 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.
|
||||
|
||||
# Docker
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
const bodyParser = require('body-parser');
|
||||
const config = require('../../conf/config');
|
||||
const { getLastJobExecution, getLastProviderExecution, getTotalNumberOfListings } = require('../services/store');
|
||||
const PORT = 9988;
|
||||
const PORT = 9908;
|
||||
const service = require('restana')();
|
||||
service.use(bodyParser.json());
|
||||
|
||||
service.get('/', async (req, res) => {
|
||||
const result = {};
|
||||
Object.keys(config.jobs).forEach(job => {
|
||||
Object.keys(config.jobs).forEach((job) => {
|
||||
result[job] = {
|
||||
lastExecution: getLastJobExecution(job),
|
||||
enabledProvider: Object.keys(config.jobs[job].provider)
|
||||
.filter(providerKey => config.jobs[job].provider[providerKey].enabled)
|
||||
.map(providerKey => {
|
||||
.filter((providerKey) => config.jobs[job].provider[providerKey].enabled)
|
||||
.map((providerKey) => {
|
||||
return {
|
||||
name: providerKey,
|
||||
lastExecution: getLastProviderExecution(job, providerKey),
|
||||
totalFindings: getTotalNumberOfListings(job, providerKey)
|
||||
totalFindings: getTotalNumberOfListings(job, providerKey),
|
||||
};
|
||||
})
|
||||
}),
|
||||
};
|
||||
});
|
||||
res.body = result;
|
||||
@@ -35,22 +35,22 @@ service.get('/jobs/:name', async (req, res) => {
|
||||
res.body = {
|
||||
lastExecution: getLastJobExecution(jobKey),
|
||||
enabledProvider: Object.keys(config.jobs[jobKey].provider)
|
||||
.filter(providerKey => config.jobs[jobKey].provider[providerKey].enabled)
|
||||
.map(providerKey => {
|
||||
.filter((providerKey) => config.jobs[jobKey].provider[providerKey].enabled)
|
||||
.map((providerKey) => {
|
||||
return {
|
||||
name: providerKey,
|
||||
url: config.jobs[jobKey].provider[providerKey].url,
|
||||
lastExecution: getLastProviderExecution(jobKey, providerKey),
|
||||
totalFindings: getTotalNumberOfListings(jobKey, providerKey)
|
||||
totalFindings: getTotalNumberOfListings(jobKey, providerKey),
|
||||
};
|
||||
})
|
||||
}),
|
||||
};
|
||||
res.send();
|
||||
});
|
||||
|
||||
service.get('/ping', function(req, res) {
|
||||
service.get('/ping', function (req, res) {
|
||||
res.body = {
|
||||
pong: 'pong'
|
||||
pong: 'pong',
|
||||
};
|
||||
res.send();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user