Files
Slide supports wide range of files support
Static files
// path and dir name
app.ServerDir("/static", "static")
Serve Single file
// single file
app.ServeFile("/js", "static/login.js")
Send Attachment
// Downloading file
app.Get("/download", func(ctx *slide.Ctx) error {
return ctx.SendAttachment("static/login.js", "login.js")
})
Uploading files
// uploading file
app.Post("/upload", func(ctx *slide.Ctx) error {
return ctx.UploadFile("static/login.js", "login.js")
})
Serve file from route
app.Get("/servefile", func(ctx *slide.Ctx) error {
return ctx.ServeFile("static/index.html")
})
Last updated
Was this helpful?