-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
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
Support SPA like express #3124
Comments
Hi @ckken I think it was already implemented in Hono. app.use(serveStatic({ root: staticPath }) }) // dist
app.get('*', (c) => c.html(html)) // html in dist |
we use hono replace express in webpack cli,Absolute root path must be use in express.static |
hmm... app.use(serveStatic({ root: "./dist" }) }) // dist
app.get('*', (c) => c.html(html)) // html in dist If we don't think the problem of performance, you can use |
The cli does not exist in the project, but is installed through npm, while hono is integrated into the cli, so there are similar demos |
I may be mistaken. |
like this #3107 |
hmm... please explain the details? |
fixed it! import {serveStatic} from 'hono/serve-static'
app.use(
'*',
serveStatic({
root: '/',
pathResolve(filePath: string) {
return path.resolve(store.outDir, filePath)
},
getContent(filePath, c) {
return fsp.readFile(filePath)
},
}),
) |
Good, I'm relieved. |
What is the feature you are proposing?
app.use(express.static(staticRoot))//dist
app.get('*', (req, res) => res.send(html))//html in dist
The text was updated successfully, but these errors were encountered: