Skip to content

Commit 2008684

Browse files
author
Phil Sturgeon
authored
Let folks know the JSON is available too (#193)
* Let folks know the JSON is available too * Conduct email now exists
1 parent 2580f77 commit 2008684

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at phil.sturgeon@wework.com. All
58+
reported by contacting the project team at oss-conduct@wework.com. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

serve.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ const htmlOrError = specFile => {
2121
}
2222
}
2323

24-
const launchServer = (app, port, specFile) => {
24+
const launchServer = (app, port, specFile, { verbose }) => {
2525
app.listen(port, () => {
26-
console.log(`API docs server running on http://localhost:${port}!`);
27-
})
28-
.on('error', e => {
26+
if (verbose > 0) {
27+
console.log(`API specifications server running!`);
28+
console.log(`HTML: http://localhost:${port}`);
29+
console.log(`JSON Specs: http://localhost:${port}/spec.json`);
30+
}
31+
}).on('error', e => {
2932
console.error('Failed to start server: ' + e.message);
3033
process.exit(1);
3134
});
@@ -48,13 +51,14 @@ const command = async (specFile, cmd) => {
4851

4952
app.use('/assets/redoc', express.static(bundleDir));
5053
app.get('/spec.json', (req, res) => {
54+
res.header('content-type', 'application/vnd.oai.openapi+json');
5155
res.send(JSON.stringify(spec));
5256
});
5357
app.get('/', (req, res) => {
5458
res.send(html);
5559
});
5660

57-
launchServer(app, port, specFile);
61+
launchServer(app, port, specFile, { verbose });
5862
}
5963

6064
const buildLoaderOptions = (jsonSchema, verbose) => {

0 commit comments

Comments
 (0)