PGCon2018 - 2.5

PGCon 2018
The PostgreSQL Conference

Speakers
Diogo Biazus
Schedule
Day Tutorials - Day 1: Tuesday - 2018-05-29
Room DMS 1150
Start time 09:00
Duration 03:00
Info
ID 1176
Event type Workshop
Track Tutorial
Language used for presentation English

Building web applications with PostgREST and Elm

Using PostgREST ( http://postgrest.com/ ) as a back end API, one can automatically translate a database schema into a fully functional set of HTTP endpoints. This makes HTTP APIs easier to design and maintain, since the definition is declarative and it handles many common details such as caching, authentication, HTTP range and content type headers among other things.

This workshop's goal is to build a simple search including the API endpoint and the front end code. Using PostgREST as a backend API the full text search can be implemented very quickly using PostgreSQL's tsvector indicies and trigram matching functions. The API is then exposed using a database namespace that is automatically translated to a set of HTTP endpoints. PostgREST will also provide automatically generated API description that will be used in a Swagger interactive UI so that attendees can gain familiarity with the generated API before diving into the front end coding. The front end part of the workshop will use a template project with ready to use HTML and stylesheets. Using this template the attendees will code a search box that interacts with the API produced in the first part of the workshop. This will give the attendees an overview of Elm architecture as seen in the Elm tutorial. The workshop is based on a personal project called Haskell Tools that can be used as a more complete example, it was also presented during a FuntionalTO meetup in Toronto.

The workshop will entail:

  1. Introduction to PostgREST and the idea of automatically generating HTTP APIs.
  2. Quick introduction to Swagger UI.
  3. Time for attendees to use a template database and create their own APIs, using the Swagger UI for quick feedback.
  4. Quick introduction to Elm and to project to be used as template for the front end.
  5. Time for the attendees to code a front end to consume the API produced in the first half of the workshop.