-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathapp.js
More file actions
63 lines (53 loc) · 2.29 KB
/
Copy pathapp.js
File metadata and controls
63 lines (53 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const path = require('path');
const swagger = require('../lib');
const serveStatic = require('serve-static');
const distPath = require.resolve('swagger-ui-dist');
const swaggerV2Definitions = require('./swagger-v2/definitions');
const swaggerV2DefinitionWithCustomizedSpec = require('./swagger-v2/definitionWithCustomizedSpec');
const swaggerV2CustomTags = require('./swagger-v2/customTags');
const swaggerV2Security = require('./swagger-v2/security');
const swaggerV2CustomMethods = require('./swagger-v2/customMethods');
const openApiV2Multi = require('./swagger-v2/multi');
const openApiV3Definitions = require('./openapi-v3/definitions');
const openApiV3DefinitionWithCustomizedSpec = require('./openapi-v3/definitionWithCustomizedSpec');
const openApiV3CustomTags = require('./openapi-v3/customTags');
const openApiV3Security = require('./openapi-v3/security');
const openApiV3CustomMethods = require('./openapi-v3/customMethods');
const openApiV3Multi = require('./openapi-v3/multi');
const openApiV3IdNames = require('./openapi-v3/idNames');
const openApiV3DoveSchemas = require('./openapi-v3/doveSchemas');
const app = express(feathers())
.use(express.json())
.use(express.urlencoded({
extended: true
}))
.use(serveStatic(distPath))
.configure(swagger.customMethodsHandler)
.configure(express.rest())
.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
})
.get('/docs', (req, res) => {
res.sendFile(path.join(__dirname, 'docs.html'));
})
.use(serveStatic(path.dirname(require.resolve('swagger-ui-dist'))))
.configure(swaggerV2Definitions)
.configure(swaggerV2DefinitionWithCustomizedSpec)
.configure(swaggerV2CustomTags)
.configure(swaggerV2Security)
.configure(swaggerV2CustomMethods)
.configure(openApiV2Multi)
.configure(openApiV3Definitions)
.configure(openApiV3DefinitionWithCustomizedSpec)
.configure(openApiV3CustomTags)
.configure(openApiV3Security)
.configure(openApiV3CustomMethods)
.configure(openApiV3Multi)
.configure(openApiV3IdNames)
.configure(openApiV3DoveSchemas)
;
const port = process.env.PORT || 3030;
console.log(`Simple app with multiple feathers-swagger examples running on http://localhost:${port}/`);
app.listen(port);