GraphQL API now in a usable state
Lassi Kortela 08 Jul 2019 16:22 UTC
I had trouble with Alpine Linux, so I reinstalled the api.schemers.org
using Void Linux (<https://voidlinux.org/>) which uses runit (a
daemontools derivative) as its native init and service supervision
system. Had an easy and pleasant time with it so far. There's an Ansible
configuration covering almost all of it.
After a long battle, a staging version of the GraphQL-based API is
finally live: <https://api.staging.scheme.fi/>
I'll push it to the official domain <api.schemers.org> once the
git-based roll-your-own-Heroku thing is done. I think production deploys
should all be git-based so that the release process is clear and
reliable (git commits automatically record all old versions in case we
need to revert, and it's easy to revert to an old version).
Anyway, at the front page <https://api.staging.scheme.fi/> there's now a
short welcome text with directions for visitors, and the GraphQL
endpoint can be explored at <https://api.staging.scheme.fi/graphql>.
Just imported the entire package index from packhack into the API, so
the following query works:
{
packages {
id
in_repos {
repo_id
one_line_description
web_url
}
}
}
There's also some stuff about the RnRS reports including official and
errata-corrected versions of the PDF documents. Next task is to
incorporate our implementation metadata and Frank's work on mapping web
documentation URLs for Scheme symbols. Frank also did a great job
scraping implementations' SRFI support information so let's fold that
into the API too. With GraphQL, turnaround time on new features is
extremely fast so this is a lot of fun!
Currently the GraphQL server is Node.js running the Express web server
and the 'graphql' package from npm. I'll start by having other Scheme
code that dumps the API data as .json files for Node to read. This is
similar to what we have done until now. Once we can figure out a good
Scheme implementation to run on Node.js we can do things in a fancier
way. We could also run a Scheme on JVM (which also has GraphQL and other
web libraries) but I expect it'll be more work since JavaScript is
generally takes a more lightweight, freewheeling approach than Java.