This is a simple application built to learn the Yesod Haskell web framework.
Start the server locally at http://localhost:3000
using
stack run
Valid routes are defined at config/routes.yesodroutes
.
The default response type is JSON, but HTML is also supported by using the Accept
content negotiation header field.
- Request:
Response:
curl http://localhost:3000
{"greeting":"Hello, World!"}
- Request:
Response:
curl 'http://localhost:3000/?name=Artem'
{"greeting":"Hello, Artem!"}
- Request:
Response:
curl http://localhost:3000 -H 'Accept: text/html'
<!DOCTYPE html> <html><head><title></title></head><body>Hello, World!</body></html>
- Request:
Response:
curl 'http://localhost:3000/?name=Artem' -H 'Accept: text/html'
<!DOCTYPE html> <html><head><title></title></head><body>Hello, Artem!</body></html>
- Request:
Response:
curl -X POST http://localhost:3000 -H 'Content-Type: application/json' -d '{"name":"Artem"}'
{"greeting":"Hello, Artem!"}
- Request:
Response:
curl -X POST http://localhost:3000 -H 'Content-Type: application/json' -d '{"name":"Artem"}' -H 'Accept: text/html'
<!DOCTYPE html> <html><head><title></title></head><body>Hello, Artem!</body></html>
- Request:
Response:
curl 'http://localhost:3000/Artem'
{"greeting":"Hello, Artem!"}
- Request:
Response:
curl 'http://localhost:3000/Artem' -H 'Accept: text/html'
<!DOCTYPE html> <html><head><title></title></head><body>Hello, Artem!</body></html>