-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve the first-time local development experience for new contributors (#489) * Allow starting only the API to simplify local frontend development * Clarofy documentation for how to start only the API, restoring a DB local backup, and testing migrations * Ensure the database is created when restoring * Fix #493 - Allow setting individual `scope2` values to `null` to get correct calculations of total emissions (#494)
- Loading branch information
Showing
5 changed files
with
119 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,44 @@ | ||
import express from 'express' | ||
import { parseArgs } from 'node:util' | ||
|
||
import queue from './queue' | ||
import discord from './discord' | ||
import api from './api' | ||
import apiConfig from './config/api' | ||
|
||
const { values } = parseArgs({ | ||
options: { | ||
'api-only': { | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
}, | ||
}) | ||
|
||
const START_BOARD = !values['api-only'] | ||
|
||
const port = apiConfig.port | ||
const app = express() | ||
|
||
app.get('/favicon.ico', express.static('public/favicon.png')) | ||
app.use('/api', api) | ||
app.use('/admin/queues', queue) | ||
|
||
app.get('/', (req, res) => { | ||
res.send( | ||
`Hi I'm Garbo! | ||
Queues: <br> | ||
<a href="/admin/queues">/admin/queues</a>` | ||
) | ||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`Running on ${port}...`) | ||
console.log(`For the UI, open http://localhost:${port}/admin/queues`) | ||
discord.login() | ||
if (START_BOARD) { | ||
const queue = (await import('./queue')).default | ||
app.use('/admin/queues', queue) | ||
app.get('/', (req, res) => { | ||
res.send( | ||
`Hi I'm Garbo! | ||
Queues: <br> | ||
<a href="/admin/queues">/admin/queues</a>` | ||
) | ||
}) | ||
} | ||
|
||
app.listen(port, async () => { | ||
console.log(`API running at http://localhost:${port}/api/companies`) | ||
|
||
if (START_BOARD) { | ||
const discord = (await import('./discord')).default | ||
console.log(`For the UI, open http://localhost:${port}/admin/queues`) | ||
discord.login() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters