mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-11 12:58:32 +03:00
* new server test with precommit hook to secure .env files, set up CI environment (#3) * [TESTS] added all registered routes to api server test * [WIP] abstracting config to env where it makes sense, refactoring elsewhere, adding more tests * [WIP] fixed tests so they fail as expected * [WIP] * [DEBUG] fixed issues with the env configuration, added correct tests * [MISC] env didn't get readded on last precommit * [TESTS] added longer wait time for server as sometimtimes tests fail arbitrarily
18 lines
364 B
JavaScript
Executable File
18 lines
364 B
JavaScript
Executable File
import { Router } from 'express'
|
|
import morgan from 'morgan'
|
|
import mapbox from './mapbox'
|
|
|
|
// eslint-disable-next-line
|
|
export default ({ config, db }) => {
|
|
let routes = Router()
|
|
|
|
/* logging middleware */
|
|
routes.use(morgan('dev'))
|
|
|
|
if (process.env.MAPBOX_TOKEN) {
|
|
routes.get('/mapbox/:z/:y/:x', mapbox(process.env.MAPBOX_TOKEN))
|
|
}
|
|
|
|
return routes
|
|
}
|