mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-12 05:18:31 +03:00
new server test with precommit hook to secure .env files, set up CI environment (#5)
* 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
This commit is contained in:
@@ -3,7 +3,10 @@ import express from 'express'
|
||||
import initialize from './initialize'
|
||||
import middleware from './middleware'
|
||||
import api from './api'
|
||||
import config from './config'
|
||||
// import config from './sheets_config'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
let app = express()
|
||||
app.server = http.createServer(app)
|
||||
@@ -15,6 +18,8 @@ if (process.env.NODE_ENV === 'development') {
|
||||
app.use(cors())
|
||||
}
|
||||
|
||||
const config = process.env
|
||||
|
||||
initialize(controller => {
|
||||
app.use(
|
||||
middleware({
|
||||
@@ -30,7 +35,7 @@ initialize(controller => {
|
||||
})
|
||||
)
|
||||
|
||||
app.server.listen(process.env.PORT || config.port, () => {
|
||||
app.server.listen(process.env.PORT || 4040, () => {
|
||||
console.log(`Started on port ${app.server.address().port}`)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user