'Swagger UI Dist Specify Custom JSON config

I might be missing something obvious, but I'm hosting a backend Node Express API and would like to expose swagger docs.

I've created by swagger.json file which contains my doc config and i've added the following code:

const express = require('express')
const pathToSwaggerUi = require('swagger-ui-dist').absolutePath()

const app = express()

app.use(express.static(pathToSwaggerUi))

app.listen(3000)

This works fine, however it renders the default pet shop documentation. How can I configure the above to use my swagger.json file instead of the default?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source