4 Commits

Author SHA1 Message Date
efarooqui
fdee3fa581 Minor changes to media endpoint 2021-06-20 23:11:38 -07:00
efarooqui
f093253d87 Removing unecessary console error 2021-06-09 20:01:20 -07:00
efarooqui
011c667805 Unpacking params for request from media 2021-06-09 01:14:02 -07:00
efarooqui
66d7d42497 Adding media fetch endpoint; working query with hardcoded incident 2021-06-08 18:46:33 -07:00
4 changed files with 39 additions and 9462 deletions

View File

@@ -4,12 +4,12 @@ LABEL authors="Lachlan Kermode <lk@forensic-architecture.org>"
# Install app dependencies
COPY package.json /www/package.json
RUN cd /www; npm install
RUN cd /www; yarn
# Copy app source
COPY . /www
WORKDIR /www
RUN npm run build
RUN yarn build
RUN mkdir -p data
# set your port
@@ -17,4 +17,4 @@ ENV PORT 4040
EXPOSE 4040
# start command as per package.json
CMD ["npm", "start"]
CMD ["yarn", "start"]

Binary file not shown.

9478
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
import { version } from '../../package.json'
import fetch from 'node-fetch'
import { Router } from 'express'
import { getParameterByName } from '../lib/util'
import copy from '../copy/en'
export default ({ config, controller }) => {
@@ -22,6 +24,21 @@ export default ({ config, controller }) => {
})
})
api.get('/media/:code', (req, res) => {
const { code } = req.params
fetch(`${process.env.MEDIA_API_ENDPOINT}/${code}`, {
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))
.catch(err => {
res.status(err.status || 404).send({ error: err.message })
});
})
api.get('/update', (req, res) => {
controller
.update()