Closed maukoese closed 5 months ago
I'm not 100% sure, but looks like scalar calls api.scalar.com which then tries to connect to localhost:3333 (in my case) .. and this obviously wouldn't work, since their server does not know anything about localhost:3333.
I assume, this should work if your app is hosted publicly with an accessible URL like https://myapp.googleapps.com or similar.
Okay. Let me deploy to production then try.
@maukoese Did it work on production?
@ad-on-is Yes it does, thank you.
@maukoese
import scalarCustomCss from '#config/scalar'
router.get('/docs', async () => {
return `
<!doctype html>
<html>
<head>
<title>API</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1" />
<style>
${scalarCustomCss}
</style>
</head>
<body>
<script
id="api-reference"
data-url="/swagger"
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
</body>
</html>
`
})
this works if you still want to use scalar!
I love te new Scalar docs, they are very beautiful and well structured.
However, when I try to make any request to test out the API I get the above error.
My config is as below:
and the routes