-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Describe the bug
serve-static is not working with Restana 5.0.0.
To Reproduce
Steps to reproduce the behavior:
import restana from "restana";
import path from "path";
const api = restana()
.use('/static', serveStatic(path.join(proccess.cwd(), './static')));
await api.start(9000);Expected behavior
Be able to access static files inside the static folder by url:
http://localhost:9000/static/example.png
Desktop (please complete the following information):
- OS: openSUSE Tumbleweed
- Node Version: 22
Additional context
There is a simple fix:
restana()
.use('/static', (req, res, next) => {
req.url = req.url?.substring('/static'.length);
return serveStatic(path.join(proccess.cwd(), './static'))(req, res, next);
})Metadata
Metadata
Assignees
Labels
No labels