-
Notifications
You must be signed in to change notification settings - Fork 543
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
hertz add fs documentation #991
Comments
same to #630 |
@Skyenought 我有点看不懂你的意思,不知道你想表达什么,我在飞书群里问这个问题,然后解决了。有大佬让我提issue分享出来,我才提了这个issue。 |
@xu756 我重新打开了这个 issue,用来跟进 StaticFS 文档的添加。 |
这是一个需要前后端配合的场景,刷新404,在 umi 文档也有几种解决方案,需要从前端配置,( 到配合 nginx 的解决形式,最后切换 nginx 的解决方案 ) 到 hertz 配合 embed 实现
|
在golang的1.16版本增加了embed的标签,方便我们将静态资源文件打包为二进制文件。
例如
下面是hertz 示例(我的打包文件在 dist文件夹下)
文件路径
main.go
路由文件 router.go
PathNotFound 必须配置到项目打包文件 index.html 否则报下面错错误
下面可以去掉,忽略
登录页面仍然会打印下面语句
2023/11/09 12:23:02.469640 fs.go:856: [Error] HERTZ: Cannot open file="dist/login", error=open dist/login: no such file or directory
我测试了几遍,可以忽略,不知道各位大佬有没有更好的解决方法。
The text was updated successfully, but these errors were encountered: