Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/molnarmark/slid
💠Slid is a static file server with routing support.
https://github.com/molnarmark/slid
file go golang route routing server slid static static-file-server
Last synced: 14 days ago
JSON representation
💠Slid is a static file server with routing support.
- Host: GitHub
- URL: https://github.com/molnarmark/slid
- Owner: molnarmark
- License: mit
- Created: 2017-03-11T20:06:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-14T19:19:25.000Z (almost 7 years ago)
- Last Synced: 2025-01-12T00:27:43.407Z (19 days ago)
- Topics: file, go, golang, route, routing, server, slid, static, static-file-server
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slid
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)
[![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)Slid is a static file server with routing.
### Example
```go
package mainimport (
"fmt""github.com/molnarmark/slid"
)func main() {
config := &slid.Config{
Port: 9898,
Dir: "files",
}// Makes a new slid instance with the config
app := slid.New(config)// Adding a route with a path and a specific handler function.
app.Get("/", func(c *slid.Context) {
c.Text("Homepage, with plain text sent.")
})// You can also call the Serve method on the context to send back a file.
app.Get("/anotherindex", func(c *slid.Context) {
c.Serve("index")
})// A quick way is also available to map a route to a filename
app.GetFile("/index", "index")app.Run(func() {
fmt.Println("Slid is running.")
})
}
```