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: 4 months 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-14T19:19:25.000Z (over 7 years ago)
- Last Synced: 2025-03-06T04:56:36.215Z (4 months 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
[](https://github.com/ellerbrock/open-source-badge/)
[](https://github.com/ellerbrock/open-source-badge/)
[](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.")
})
}
```