Snap for Beginners

Sample Chapter: Digestive Functors (Form Processing)

Snaplet PostgreSQL Simple

Basics

Before installing snaplet-postgresql-simple you must have postgres installed on your system. Specifically, pg_config must be available on your path, which can come in postgresql-devel, libpq-dev or postgresql depending on your operating system of choice.

The important parts to note are the inclusion of an additional nestSnaplet call for the database and the inclusion of the initialized Snaplet in the returned App value.

d<-nestSnaplet"db"dbpgsInit-- andreturn$Apphsda

Configuration

By default, Snaplets create their filesystem on first run of the application if there are no files already there. The Postgres files live in snaplets/postgresql-simple/devel.cfg and look like this by default: