We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a folder with index.js Also create a subfolder "static" containing index.html with "hello world" in it
const nanoexpress = require('nanoexpress'); const staticServe = require('@nanoexpress/middleware-static-serve/cjs'); const path = require('path'); const app = nanoexpress(); app.use(staticServe(path.join(__dirname, 'static'))); app.get('/', (req, res) => { return res.send({ status: 'ok' }); }); app.listen(3000);
then open http://localhost:3000/index.html this return: {"code":404,"message":"The route does not exist"} but http://localhost:3000/ do return "hello world"
so the issue seems to be the routing for all other paths except "/"
The text was updated successfully, but these errors were encountered:
@jbenguira If you can fix it now, please create PR, i'll look into at end of month if i can. Thanks for trying out nanoexpress
Sorry, something went wrong.
How can I serve static files on specific routes? I want to serve index.html file on "/" route of react build folder. any idea?
I look into in next month as i hope i'll can get some free time. Otherwise i hope anyone can submit PR
No branches or pull requests
Bug Report
Is you/your team sponsoring this project
If your team sponsoring this project, please attach here your team lead or who purchased license GitHub login
Minimal reproducible repo
create a folder with index.js
Also create a subfolder "static" containing index.html with "hello world" in it
then open http://localhost:3000/index.html
this return: {"code":404,"message":"The route does not exist"}
but http://localhost:3000/ do return "hello world"
so the issue seems to be the routing for all other paths except "/"
Environment
"dependencies": {
"@nanoexpress/middleware-static-serve": "^1.0.1",
"nanoexpress": "^2.4.9"
}
The text was updated successfully, but these errors were encountered: