Questions tagged [scotty]

Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp (Official Repository)

A Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp.

Scotty is the cheap and cheerful way to write RESTful, declarative web applications.

  • A page is as simple as defining the verb, url pattern, and Text content.
  • It is template-language agnostic. Anything that returns a Text value will do.
  • Conforms to WAI Application interface.
  • Uses very fast Warp webserver by default.

GitHub: https://github.com/scotty-web/scotty

104 questions
0
votes
1 answer

Do block resolve types

I just start coding in Haskell recently and I start getting use of do block. I'm coming from Scala world, and after read a book and some blogs I see that do block was the inspiration of our from comprehension. But still I´m struggling with the…
paul
  • 12,873
  • 23
  • 91
  • 153
0
votes
2 answers

How to match all requests (catch all) with Haskell Scotty?

I have a simple server {-# LANGUAGE OverloadedStrings #-} import Web.Scotty import Data.Text import Data.Monoid (mconcat) server :: ScottyM () server = do get "/" $ file "./index.html" And i want to serve index.html on all the routes eg. get…
ColdHands
  • 947
  • 8
  • 28
0
votes
1 answer

How to display Response from an HTTP GET Request in front-end using Scotty?

I'm trying out Scotty for the first time and I can't seem to get past making my GET request. The Response is returned as type IO (Response bytestring-0.10.8.1:Data.ByteString.Lazy.Internal.ByteString) I know I need to convert it to a type that…
0
votes
1 answer

Retrieve the HTTP referrer URL using Scotty

$_SERVER[HTTP_REFERER] allows one to retrieve the referring URL in PHP, how to do the same in Haskell?
x4rkz
  • 513
  • 4
  • 19
0
votes
1 answer

Scotty web service

I need to create a web service to convert between different currencies using the scotty web framework in Haskell. The web service should respond to get requests such as /convert/15?to=usd&from=eur. I have this code so far: {-# LANGUAGE…
Antman
  • 453
  • 2
  • 8
  • 18
0
votes
1 answer

How to capture multiple URL parameters / segments?

Given a url like http://test.com/abc/xyz/1/2/3, how can I retrieve all the URL segments after abc/ so the resulting value would be ["xyz","1","2","3]?
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
0
votes
1 answer

How to combine WebDriver and Scotty monads

I am beginner, so please bear with me. I have a following code: {-# LANGUAGE OverloadedStrings #-} module Lib where import Control.Monad.IO.Class import Control.Monad.Trans.Class import Data.Monoid …
monnef
  • 3,903
  • 5
  • 30
  • 50
0
votes
2 answers

Serve static files from memory in Scotty webapp

For ease of app relocation I would like to serve static files from memory instead of disk in my Scotty application. I'm currently using wai-middleware-static to serve files from disk but I see that there is a wai-app-static that could do it, but it…
ase
  • 13,231
  • 4
  • 34
  • 46
0
votes
1 answer

How Scotty make an Applicative constructor

{-# LANGUAGE OverloadedStrings #-} import Control.Applicative import Data.Monoid import Data.String import Network.Wai.Middleware.RequestLogger import Web.Scotty data FullName = FullName { firstName :: String, lastName :: String } lastFirst ::…
nobody
  • 414
  • 2
  • 8
  • 18
0
votes
1 answer

Cleaning up after a Scotty application is terminated

I have a Scotty application that listens on a Unix socket. I’d like the application to delete the socket when it exits (i.e. when I type Ctrl-C), but I’m not sure how to accomplish this. My main function looks like main = do sock <- socket…
bdesham
  • 15,430
  • 13
  • 79
  • 123
0
votes
1 answer

Dynamically add routes at compile time in Scotty

Is it possible to add routes dynamically at compile time through a config file by using Template Haskell or any other way. Scotty has a function addRoute but I want to use it dynamically. Example import qualified Data.Text.Lazy as LTB sampleRoutes…
user2512324
  • 791
  • 1
  • 6
  • 21
0
votes
1 answer

Retrieving values from SQLite3 Database for Scotty

I'm trying to get information from a SQLite DB (HDBC.sqlite3) to feed to a web view using the Scotty framework. I'm currently trying to complete a "grab all" or rather select all the information from the table and then return it to display on my…
Sleep Deprived Bulbasaur
  • 2,368
  • 4
  • 21
  • 33
0
votes
1 answer

Example of .cabal file for fay project

I have a simple web app written with scotty. I would like to use fay to generate the front-end JS code and use shared types between the frontend and the backend. At the moment, I run my app using cabal run: in my .cabal file I defined an…
lbolla
  • 5,387
  • 1
  • 22
  • 35
-1
votes
1 answer

Problems using Persistent's getJust with entityIdToJSON

I am new to Haskell and am trying to write a Scotty web API with Persistent as the ORM. I am having problems with the following code: share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| Account json name String …
poida
  • 3,403
  • 26
  • 26
1 2 3 4 5 6
7