Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/koron/go-spafs

File server which specialized for SPA
https://github.com/koron/go-spafs

golang http spa

Last synced: 24 days ago
JSON representation

File server which specialized for SPA

Awesome Lists containing this project

README

        

# SPA Specialized File Server

spafs is a file server which specialized for SPA (single page application).
This serves content of index.html in nearest ancestral directory for
unavailable path.

## How to use

Install and update:

```console
go get -v -u github.com/koron/go-spafs
```

Example code:

```go
package main

import (
"http"
spafs "github.com/koron/go-spafs"
)

func main() {
fs := spafs.FileServer(http.Dir("./testdata"))
err := http.ListenAndServe(":8080", fs)
if err != nil {
panic(err)
}
}
```