mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-12 05:18:31 +03:00
Adding media fetch endpoint; working query with hardcoded incident
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { version } from '../../package.json'
|
import { version } from '../../package.json'
|
||||||
|
import fetch from 'node-fetch'
|
||||||
import { Router } from 'express'
|
import { Router } from 'express'
|
||||||
import copy from '../copy/en'
|
import copy from '../copy/en'
|
||||||
|
|
||||||
@@ -22,6 +23,18 @@ export default ({ config, controller }) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
api.get('/media', (req, res) => {
|
||||||
|
fetch(`${process.env.MEDIA_API_ENDPOINT}/cv_a12`, {
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Basic ' + new Buffer(process.env.MEDIA_AUTH_USER + ":" + process.env.MEDIA_AUTH_PWORD).toString("base64")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => res.send(data.data))
|
||||||
|
.catch(err => res.status(err.status || 404).send({ error: err.message }));
|
||||||
|
})
|
||||||
|
|
||||||
api.get('/update', (req, res) => {
|
api.get('/update', (req, res) => {
|
||||||
controller
|
controller
|
||||||
.update()
|
.update()
|
||||||
|
|||||||
Reference in New Issue
Block a user