A small uploader application I wrote as a demonstration for a blog post based on
- React (w/ TypeScript)
- Relay (modern) w/ react-relay-network-modern
- Elixir/Phoenix w/ Absinthe &
Absinthe.Relay
This is mostly to demonstrate how one can facilitate single file uploads with Absinthe and Relay modern.
The more interesting parts are:
- The multipart middleware for react-relay-network-modern
- The resolver taking in the file and handling it to the Context
If you want to execute this project, you can use docker-compose to run it:
$ docker-compose pull
and a
$ docker-compose up -d
should do it.
I've included a relay compiler compatible image, so you can run everything inside the docker container:
# to generate graphql types via relay
$ docker-compose exec app yarn relay --watch
# for a production build
$ docker-compose exec app yarn deploy
Please note that you do not have to run yarn for development, as the Application will keep a watcher up.
Send me an email or open an issue, both is fine. I am always interested in feedback.
- relay environment docs
- The uploader discussion on complying with the suggestion for the multipart request spec, which absinthe does not support (as of yet)
- The Apollo upload client which supports the spec
- The most excellent @ScripterSugar providing the middleware for the nodejs based reference middleware