packages feed

RESTng-0.1: Example/README

Note: 
-----
RESTng does not support different rdbms yet. For the moment we are just using PostgreSQL.


The Example Application:
------------------------

The example application is a standalone RESTful web application running in the port 8080.

In this application the resources and resource relations are: 
  - User defined resources: authors and books
  - System defined resources: tags, rating votes and comments.
  - Resource relations: 
       - Authors can be tagged and have books. 
       - Books can also be tagged, can be voted and have comments.

  (This is defined in the function resList in the file main.hs)

  These kind of urls and actions will be available:

    GET  http://localhost:8080/author/              (list the authors)
    GET  http://localhost:8080/author/new.html      (show the form for filling an author)
    POST http://localhost:8080/author/new.html      (create the author)
    GET  http://localhost:8080/author/1.html        (show the author with id 1)
    GET  http://localhost:8080/author/1/edit.html   (show the form for editing the author with id 1)
    POST http://localhost:8080/author/1/edit.html   (update the author with id 1)
    POST http://localhost:8080/author/1/delete.html (delete the author with id 1)

    GET  http://localhost:8080/book/                (list the books)
    GET  http://localhost:8080/book/new.html        (show the form for filling an book)
    and so on for the other actions (like authors)

    Also there are actions for comments and other system resources.

    And there are actions available for nested resources using hierarchical URLs, i.e.

    GET  http://localhost:8080/author/1/book/       (list the books of author with id 1)
    GET  http://localhost:8080/author/1/book/new (likewise author new. The form won't have a visible field for the author since it is already defined.)
    POST http://localhost:8080/author/1/book/new (The form does not have the author field since goes in the URL)
    and so on for the other actions on books

    Also:
       GET  http://localhost:8080/book/1/comment/new.html
       POST http://localhost:8080/book/1/comment/new.html

       GET http://localhost:8080/author/1/resourcetag/new.html

       just to name a few.


DB configuration:
-----------------
1) Create a new database (without tables) and setup access permissions as you like.
2) Modify the file Config.hs to setup your connection string to the db.


Build: 
------

Simply run "make". 2 executables will be created. 
They are:
   - CreateSchema: Run this one first for creating the tables.
   - main: This is the web standalone application.

Run:
----
1) Run "main" for running the application.
2) Start a browser and try actions like the ones mentioned above in the section "The Example Application".