📁
slide
  • Slide
  • Routing
  • Files
  • Middlewares
Powered by GitBook
On this page
  • Static files
  • Serve Single file
  • Send Attachment
  • Uploading files
  • Serve file from route

Was this helpful?

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")
})
PreviousRoutingNextMiddlewares

Last updated 4 years ago

Was this helpful?