There are more changes you can make beyond just adjusting the css. If you create your Loopback application using slc loopback
as I did, you'll notice that the server/server.js
file does not initially appear in a configurable format like it is shown in the accepted answer.
Instead, you can utilize the server/component-config.json
file to direct the loopback component explorer to use a different directory for static files for the swagger-ui. By setting the uiDirs
configuration as shown below, I directed it to search for static files in the server/explorer
directory.
{
"loopback-component-explorer": {
"mountPath": "/explorer",
"uiDirs": "server/explorer",
"apiInfo": {
"title": "My API",
"description": "Description of my API"
}
}
}
* If using IISNode, set uiDirs
to "explorer"
; otherwise, it should be "server/explorer"
as per @phegde 's comment
I created an index.html in my server directory by copying from
node_modules/loopback-component-explorer/public/index.html
, and also added an images folder with a personalized logo.
https://i.stack.imgur.com/IENrd.png
Lastly, to apply custom css, duplicate the
node_modules/loopback-component-explorer/public/css/loopbackStyles.css
into
server/explorer/css/loopbackStyles.css