go服务如何使用静态文件?

go 复制代码
package main

import "github.com/gin-gonic/gin"

func main() {
    router := gin.Default()

    // 配置第一个静态文件目录
    router.Static("/static1", "templates/static1")

    // 配置第二个静态文件目录
    router.Static("/static2", "templates/static2")

    // 启动服务器
    router.Run(":8080")
}
go服务如何使用静态文件?

app.Static 配置多个静态可以通过Static 方法。

相关推荐
聆风吟º4 分钟前
【Spring Boot 报错已解决】Error creating bean with entityManagerFactory 原因分析与解决方案
java·spring boot·后端
o***74174 分钟前
SpringBoot【十一】mybatis-plus实现多数据源配置,开箱即用!
spring boot·后端·mybatis
S***84885 分钟前
【spring boot】 IDEA 启动springboot项目报missing ServletWebServerFactory
spring boot·后端·intellij-idea
William_cl5 分钟前
【ASP.NET进阶】Controller 层 Action 返回值:HttpStatusCodeResult 状态码返回全解析
后端·asp.net
W***D4556 分钟前
SpringBoot + vue 管理系统
vue.js·spring boot·后端
Ankkaya11 分钟前
小白服务器踩坑
后端
拾贰_C12 分钟前
[python ]anaconda
开发语言·python
VX:Fegn089513 分钟前
计算机毕业设计|基于springboot + vue毕业设计选题管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·课程设计
h***673717 分钟前
springboot设置多环境配置文件
java·spring boot·后端
VBA633717 分钟前
VBA数据库解决方案第二十五讲:工作表中数据在数据表中批量删除
开发语言