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

I think I spotted an error #21

Closed
SpLauT opened this issue Jul 13, 2021 · 2 comments
Closed

I think I spotted an error #21

SpLauT opened this issue Jul 13, 2021 · 2 comments

Comments

@SpLauT
Copy link

SpLauT commented Jul 13, 2021

Hello! I really think what you are doing here is grand!
I am in the mutable state area

counterHandler :: Int -> Server.Request -> (Int, Server.Response)
counterHandler currentCount
= (newCount, response)
where
newCount
= currentCount + 1
response
= Server.simpleHandler ("Current count: " ++ show newCount)

Where the counterHandler is, I think you wanted to use Server.stringResponse?
Also you only have the currentCount, and not the req as a parameter

Only want to help, so if I am stupid just tell me to shut up! :)

@SpLauT
Copy link
Author

SpLauT commented Jul 13, 2021

main :: IO ()
main
= Server.startServer
[ Server.handlersWithState initialState [counterHandler]
]

I made this work with: Server.handlersWithState initialState [Server.statefulHandler Server.GET "/count" counterHandler]

@alpacaaa
Copy link
Owner

You're absolutely right, thanks for spotting this! :)

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

No branches or pull requests

2 participants