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

Add explanation how to run local web server #119

Merged
merged 1 commit into from
Oct 1, 2022
Merged

Conversation

cdepillabout
Copy link
Owner

This PR is for #116. It just adds a simple explanation of how to run a local web server.

@cdepillabout cdepillabout mentioned this pull request Sep 28, 2022
Running this executable with `cabal run web` will start a web server listening on
`0.0.0.0:8000`. You should be able to see the web page by opening
<http://localhost:8000> in a web browser. _Note_ that you will need to run
`cabal run web` within this current directory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is presumably because runApp refers to style.css by relative path. There should be some way around this. Maybe using file-embed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could use something like file-embed to do this. I figured just explaining it in the documentation was the easiest thing to do here, but we could always improve it in the future it ends up being annoying.

@@ -26,10 +26,12 @@ import Text.Pretty.Simple.Internal (Annotation (..), layoutStringAbstract)

#ifndef __GHCJS__
runApp :: JSM () -> IO ()
runApp f =
runApp f = do
putStrLn "Web server running on 0.0.0.0:8000..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, why 0.0.0.0 instead of localhost?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that by default warp actually does listen on all interfaces (0.0.0.0), and not just localhost. So I felt this message was "more correct", although I guess some developers might not know that 0.0.0.0 means they can connect by accessing http://127.0.0.1:8000.

@cdepillabout cdepillabout merged commit 932887a into web Oct 1, 2022
@cdepillabout cdepillabout deleted the web-explanation branch October 1, 2022 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants