Questions tagged [haskell-wai]

The wai package provides a common protocol for the communication between Haskell web applications and web servers.

The wai package provides a common protocol for the communication between Haskell web applications and web servers.

GitHub Repo: https://github.com/yesodweb/wai

Source: http://hackage.haskell.org/package/wai

73 questions
20
votes
2 answers

Scotty: connection pool as monad reader

There are trillions of monad tutorial including the reader and it seems all clear when you read about it. But when you actually need to write, it becomes a different matter. I'v never used the Reader, just never got to it in practice. So I don't…
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
12
votes
2 answers

Simple questions about the scotty Haskell web framework

Consider the simplest scotty app: {-# LANGUAGE OverloadedStrings #-} import Web.Scotty import Data.Monoid (mconcat) main = scotty 3000 $ do get "/:word" $ do beam <- param "word" html $ mconcat ["

Scotty, ", beam, " me…

stackoverflowuser
  • 1,157
  • 9
  • 18
10
votes
1 answer

What forces drove WAI Application to be redesigned five times?

I took a curious look at WAI interface and while it looks simple, I was surprised to see how many iterations it took to stabilize at the current form! I had assumed that CPS style for resource safety would be the most interesting thing but it looks…
sevo
  • 4,559
  • 1
  • 15
  • 31
8
votes
1 answer

Serving Static Files With Servant / Wai

I am following this tutorial http://www.parsonsmatt.org/programming/2015/06/07/servant-persistent.html to create APIs through servant. I want to customize the server to serve static files as well but couldn't find a way to do it. I am using the…
Ecognium
  • 2,046
  • 1
  • 19
  • 35
8
votes
1 answer

Web Scotty: file not found while serving static files

This must be something really stupid. I just started playing with scotty and cannot get the static content served correctly. import Network.HTTP.Types import Web.Scotty import qualified Data.Text as T import Data.Monoid (mconcat) import Data.Aeson…
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
7
votes
1 answer

Middleware for per-request data

In clojure, I can write something like this: (defn wrap-my-header [handler] (fn [request] (let [request (if (get-in request [:headers "my-header"]) (assoc request :has-my-header? true) request)] …
autumn322
  • 447
  • 3
  • 10
7
votes
2 answers

Which Websockets library to use with Yesod?

I'm wondering if someone could explain the differences between the Haskell websocket libraries and how they work with Yesod. The two main examples I'm going off are this tutorial for Network.Websockets and the wai websockets package. I haven't been…
jmite
  • 8,171
  • 6
  • 40
  • 81
6
votes
3 answers

How can I limit size of request body and headers in WAI?

I am developing an application using Scotty and of course WAI. I would like to be able to limit the size of requests, both for body length and for headers. How can I do that? Is it possible to do it using a plain WAI middleware ?
insitu
  • 4,488
  • 3
  • 25
  • 42
6
votes
1 answer

How can I set up wai-handler-devel with Scotty to have automatic code reloading?

I've been playing around with the Scotty web framework and tried to make it work with wai-handler-devel to enable code reloading. Here's an example app {-# LANGUAGE OverloadedStrings #-} module Example where import Data.Monoid (mconcat) import…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
5
votes
1 answer

How do I use wai-handler-devel with a simple wai application

I have the basic "hello world" application setup using wai, and would like to use wai-handler-devel, but am unsure how to go about it and can't find any examples of it in usage on a wai project. {-# LANGUAGE OverloadedStrings #-} import…
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
5
votes
1 answer

Wai template functions cannot find Libz.so

: can't load .so/.DLL for: libz.so (libz.so: cannot open shared object file: no such file or directory) This is the error I'm getting while trying to install some of the WAI…
John F. Miller
  • 26,961
  • 10
  • 71
  • 121
5
votes
1 answer

How to log the real IP address when behind a proxy using Scotty / wai

This is my scotty app, notice how I am logging requests to the console: {-# LANGUAGE OverloadedStrings #-} import Web.Scotty import Network.Wai.Middleware.RequestLogger import Data.Monoid (mconcat) main = scotty 3000 $ do --log requests to…
stackoverflowuser
  • 1,157
  • 9
  • 18
4
votes
1 answer

Haskell-Scotty: Set custom headers (x-frame-options)

Haskell newbie here! In my haskell side project, I am using scotty to serve some dynamically generated html pages. The problem is that the pages can not be opened inside an iframe, due to the "x-frame-options" header set to "SAMEORIGIN". How can I…
afcastano
  • 548
  • 3
  • 17
4
votes
2 answers

Avoiding Errors caused by IO when talking to a database inside of a WAI handler

I am writing a web service in haskell using warp, wai, and acid-state. As of now, I have two handler functions that require database interaction, the latter of which is giving me trouble. The first, is registration: registerUser :: AcidState…
user3594595
4
votes
1 answer

Customizing response headers in Wai middleware

I'm currently using wai-middleware-static to serve up custom pages for my server. However, i saw that my server was getting requests for favicon.ico, etc. on every page load, and also every single one of my web fonts, so i decided to check the…
Justin L.
  • 13,510
  • 5
  • 48
  • 83
1
2 3 4 5