Skip to content
프로젝트

소개

빠른 개발을 위한 또 하나의 Haskell 웹 프레임워크

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

  • fast typesafe routing
  • request IDs and structured logging
  • optional persistent PostgreSQL sessions
  • optional encrypted cookie sessions

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Spock

Build status Hackage Hackage Spock-Core

Intro

Another Haskell web framework for rapid development. To get started with Spock, check our tutorial or take a look at our example project funblog!

Mailing list

Please join our mailing list at [email protected]

Features

Another Haskell web framework for rapid development: This toolbox provides everything you need to get a quick start into web hacking with haskell:

File uploads

Use filesMulti to retrieve every uploaded file, grouped by form field name. For example, an <input type="file" name="documents" multiple> can be read with:

uploads <- filesMulti
let documents = HM.lookupDefault [] "documents" uploads

Here HM is Data.HashMap.Strict. Each list preserves upload order, and each UploadedFile provides its name, content type, and temporary location. Process or copy the temporary files during the request; they are removed when it finishes. The existing files function continues to return the last file for each field.

Important Links

Talks

Candy

Extensions

The following Spock extensions exist:

Works well with Spock

SSL / HTTPS

If you'd like to use your application via HTTPS, there are two options:

  • Use nginx/haproxy/... as reverse proxy in front of the Spock application.
  • Convert the Spock application to a wai-application using the spockAsApp. Then use the warp-tls package to run it.

Notes

Since version 0.11.0.0 Spock drops simple routing in favor of typesafe routing and drops safe actions in favor of the "usual" way of csrf protection with a token.

Since version 0.7.0.0 Spock supports typesafe routing. If you wish to continue using the untyped version of Spock you can Use Web.Spock.Simple. The implementation of the routing is implemented in a separate haskell package called reroute.

Since version 0.5.0.0 Spock is no longer built on top of scotty. The design and interface is still influenced by scotty, but the internal implementation differs from scotty's.

Thanks to

Hacking

The native packages use GHC 9.14.1. Install it with GHCup, along with Cabal 3.16.0.0 or newer (CI uses 3.18.1.0):

ghcup install ghc 9.14.1
ghcup set ghc 9.14.1
ghcup install cabal 3.18.1.0
ghcup set cabal 3.18.1.0
cabal update
cabal build all
cabal test all --test-show-details=direct

The Cabal project enables all native libraries, tests, and the routing benchmark. To run the benchmark, use cabal bench reroute.

For session retention and HTTP performance investigations, see the session soak and HTTP comparison benchmark.

Stack 3.11.1 is also supported. stack.yaml pins the package snapshot and overrides its compiler with GHC 9.14.1; stack.yaml.lock records the resolved dependencies:

stack build --test --bench --no-run-tests --no-run-benchmarks
stack test -j 1

Spock-api-ghcjs now targets GHC's JavaScript backend. Its protocol tests also run in the native build. cabal.project.javascript replaces the historical stack-ghcjs.yaml; the browser example installs the pinned GHC JavaScript 9.12.2/Emscripten toolchain and builds a shared Haskell client and server. CI runs its compiled client in Chromium.

Pull requests are welcome! Please consider creating an issue beforehand, so we can discuss what you would like to do. Code should be written in a consistent style throughout the project. Avoid whitespace that is sensible to conflicts. (E.g. alignment of = signs in functions definitions)

Note that by sending a pull request you agree that your contribution can be released under the BSD3 License as part of the Spock package or related packages.

Misc

Officially Supported GHC Versions

  • 9.14.1 (Linux, macOS, and Windows CI)
  • 9.12.2 JavaScript backend (browser packages; Linux CI and macOS validation)

License

Released under the BSD3 license. (c) 2013 - 2021 Alexander Thiemann

관련 프로젝트 살펴보기

불러오는 중…