-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
I'm noticing the generated json and yml does have basePath in it, but the server is not accessible with the base path.
The generated swagger.json
{
"basePath": "/swagger-demo",
"definitions": {},
..
..
..
My swaggerConfig.json is
"swagger": {
"basePath": "/swagger-demo",
"outputDirectory": "./dist",
"entryFile": "./src/routes/catService.ts",
}
}```
My server.ts is
```import express from 'express';
const app = express();
import bodyParser from 'body-parser';
import {Server} from "typescript-rest";
import {CatService} from "./routes/catService";
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
app.get('/ping', (req: any, res: any) => { res.send('PONG')});
Server.buildServices(app, CatService);
app.listen(3000);
console.log(`Server @: 3000`);
Expected result: the api end points should be accessible at
http://localhost:3000/swagger-demo/cat
http://localhost:3000/swagger-demo/ping
If this problem relates to the typescript-rest module, I'm happy to move it.
Metadata
Metadata
Assignees
Labels
No labels