项目作者: maikeulb

项目描述 :
Restful API with Suave
高级语言: F#
项目地址: git://github.com/maikeulb/Museums.git
创建时间: 2018-03-25T18:08:53Z
项目社区:https://github.com/maikeulb/Museums

开源协议:

下载


Museums

Restful API for NYC Museums. The resources are the museums and their paintings.

Technology

  • Suave
  • PostgreSQL (using SQLProvider)
  • Flyway

Endpoints

Method URI Action
GET /api/museums Retrieve all museums
GET /api/museums/{mid} Retrieve museum
POST /api/museums Add museum
PUT /api/museums/{mid} Update museum
DELETE /api/museums/{mid} Remove museum
GET /api/museums/{mid}/paintings Retrieve all museum paintings
GET /api/museums/{mid}/paintings/{id} Retrieve museum painting
POST /api/museums/{mid}/paintings Add museum painting
PUT /api/museums/{mid}/paintings/{id} Update museum painting
DELETE /api/museums/{mid}/paintings/{id} Delete museum painting

Sample Responses

http get http://localhost:8080/api/museums

  1. [
  2. {
  3. "id": 1,
  4. "name": "Museum of Modern Art"
  5. },
  6. {
  7. "id": 2,
  8. "name": "Whitney Museum of American Art"
  9. },
  10. ...

http get http://localhost:8080/api/museums/{mid}/paintings

  1. [
  2. {
  3. "artist": "Vincent van Gogh",
  4. "id": 1,
  5. "medium": "Oil on canvas",
  6. "museumId": 1,
  7. "title": "The Starry Night"
  8. },
  9. {
  10. "artist": "Salvador Dali",
  11. "id": 2,
  12. "medium": "Oil on canvas",
  13. "museumId": 1,
  14. "title": "The Persistence of Memory"
  15. },
  16. ...

Run

You need Mono, forge, and fake to run the API. There are two branches: the
master branch is the in-memory solution (which is buggy), and the postgres
branch is the persistent solution. To run the postgres branch: create
a database, open db.fs and point the URI to your database, and apply the
migrations (scripts located in the migrations folder).

  1. git checkout postgres
  2. forge fake run
  3. Go to http://localhost:8080 and visit one of the above endpoints

TODO

Dockerfile