Skip to content

RESTful web service implemented in Haskell/snap with a MongoDB backend

Notifications You must be signed in to change notification settings

kongo2002/snaprest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 

Repository files navigation

snaprest

This is a small RESTful web service implemented in Haskell using the snap framework and using a MongoDB backend.

Installation

As prerequisites you will have to install mongodb and ghc. Follow your OS's and distribution's installation intructions for that. After that you can continue with installing snaprest via cabal:

$ git clone git://github.com/kongo2002/snaprest.git
$ cd snaprest
$ cabal install

Now you should be able to start snaprest on your console. Make sure your compiled executable can be found in your PATH and your mongodb is running.

$ snaprest

Testing

Once snaprest is running you should be able to test the web service using curl:

$ curl -X PUT -d '{"firstName":"some","lastName":"one"}' localhost:8000/users/user

{"data":{"id":1,"firstName":"some","lastName":"one"},"success":true}

$ curl localhost:8000/users/user/1

{"data":{"id":1,"firstName":"some","lastName":"one"},"success":true}

Development

During development it is really handy to be able to test snaprest in your GHCI interactive haskell shell:

Prelude> :l Main
...
*Main> main
...
Listening on http://0.0.0.0:8000/

The running server can then be stopped with Ctrl-C, recompiled with :r and started with main.

About

RESTful web service implemented in Haskell/snap with a MongoDB backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published