Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a built in HTTP server snowman server #4

Closed
Abbe98 opened this issue Jul 21, 2021 · 3 comments
Closed

Create a built in HTTP server snowman server #4

Abbe98 opened this issue Jul 21, 2021 · 3 comments
Labels
🏅 enhancement New feature or request

Comments

@Abbe98
Copy link
Collaborator

Abbe98 commented Jul 21, 2021

To implement Livereload we need an inbuilt HTTP server but it also makes sense as an individual feature.

snowman server should spin up an HTTP server in the site directory.

Part of #2.

@Abbe98
Copy link
Collaborator Author

Abbe98 commented Jul 22, 2021

Something as simple as?

package main

import (
    "fmt"
    "net/http"
)

func main() {

    fileServer := http.FileServer(http.Dir("./public"))
    http.Handle("/", fileServer)

    fmt.Printf("Starting server at port 8080")
}

@Abbe98
Copy link
Collaborator Author

Abbe98 commented Jul 22, 2021

@Abbe98
Copy link
Collaborator Author

Abbe98 commented Jul 22, 2021

Abbe98 added a commit that referenced this issue Jul 24, 2021
…server` #4

This is a very early poc which needs to be refectored.

First the server needs to run in a seperate channel so that we can watch the filesytem and run the livereload server in parallel(#4). Then we need to listen to signals like CTRL+C to gracefully shut the server down.

https://rafallorenz.com/go/handle-signals-to-graceful-shutdown-http-server/
@Abbe98 Abbe98 closed this as completed Jul 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏅 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant