A digital edition of The Sarum Hymnal, a 16th-century part-book. Service to calculate and retreive sarum hymnal data from PostgreSQL and serve via a RESTful API
Requires go.
Install dependancies and build binary:
$ go get
"github.com/lib/pq" \
"github.com/fsnotify/fsnotify" \
"github.com/gorilla/mux" \
"github.com/spf13/viper"
$ go build
Requires a running instance of PostgreSQL that sarum can access.
{
"postgres":{
"maxtimeoutattempt": 1,
"account": {
"user": "postgres",
"password": "pass",
"dbname": "sarumhymnal",
"schema": "sarumhymnal"
},
"conn": {
"host": "localhost",
"port": "5432",
"sslmode":"disable"
}
},
"host":{
"timeout": {
"write": 15,
"read": 15,
"idle": 60,
"cancel": 60
},
"domain": "localhost",
"port": ":8080"
}
}
$ ./sarumhymnal
Initialises webserver with the following routes:
Query a specific folio to retreive hymns described on that folio. Valid folio must be of form [0-9]{3}[r|v]{1}
Invalid folio requests will return 400
response.
{
"[name]": {
"image": "[image]"
"folio": "[folio"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline"
"melody": "[melody]"
"cycle": "[cycle]"
},
...
}
Query a specific date to retreive hymns chanted on that date. Valid date must be of form yyyy-mm-ddThh:mm:ss.ffffff
.
Date of easter on specified year must also be provided in same form.
Invalid date requests will return 400
response.
{
"matins": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"lauds": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"prime": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"terce": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"sext": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"none": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"vespers1": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
},
"vespers2": {
"image": "[image]"
"folio": "[folio]"
"staves": "[staves]"
"hymn": "[hymn]"
"clef": "[clef]"
"firstLine" "[firstline]"
"melody": "[melody]"
"cycle": "[cycle]"
}
}
A SQL dump db.sql
is provided to rebuild schema containing some sample data that may be used.
To reload the script into a fresh Postgres DB use:
psql -d newdb -f db.sql