absinthe_tutorial
absinthe_tutorial copied to clipboard
ordered result example
Some things to note about this:
- I definitely want to make this easier for folks, in that they shouldn't need to copy a ~100 line file into their project just to change on line. This is also brittle, since it won't be easy to keep up with any changes Absinthe makes. See the module notes for ideas.
- There isn't any need to change middleware at all, or mess with the default middleware. Maintaining order has nothing to do with middleware
- Pipeline configuration is more of a pain than it should be. We should make that easier too.
- This avoids global config flags. This is good because concerns like this are rather client specific. An
OrdMapor:orddictor whatever it is you end up using won't be as ergonomic to work with in Elixir itself as a map, so this preserves the normalAbsinthe.runbehaviour.
Hey @benwilson512, I spent today's afternoon and evening trying to install this project's dependencies and run a server, but I wasn't lucky.
I encountered many platform specific (Windows) and maybe general problems, e.g. with:
- building jiffy: https://github.com/davisp/jiffy/issues/83
- using rebar3: https://github.com/erlang/rebar3/issues/1617
- install argon2_elixir : solved with https://medium.com/@rpw952/elixir-development-on-windows-10-ff7ca03769d
- routing problem after
mix phx.server: no route found for GET / (BlogWeb.Router)
Well, I've managed to compile Elixir 1.6.0-dev from source code - it solved some issues and I've updated this guide: https://github.com/elixir-lang/elixir/wiki/Windows. However, it's recommended to install OTP 21 to eliminate the problem with jiffy/rebar3, but compilation OTP from sources is very painful (at least for Windows users).
It's not possible for me to switch to another platform now, so I have to wait for official OTP 21 release and then I'll try it again. Sorry for that and thanks for your time and this PR. (I'm new to Elixir world, because I'm mainly Typescript/JS/C# programmer in day-job, so if you know another way to start this project I will be very grateful and I can write some guides about it later.)
Hey! Sorry about the difficulties, I'll get a PR up that shows the main point I'm going for without the challenging libraries you have mentioned.
Should go up sometime tomorrow.
Hey! Success! I've managed to run this with Nanobox and Docker. So everything works fine, except GraphiQL, I suggest to add codec and pipeline settings:
forward "/graphiql", Absinthe.Plug.GraphiQL,
schema: BlogWeb.Schema,
json_codec: BlogWeb.JSON,
pipeline: {__MODULE__, :absinthe_pipeline}
and add flag to json.ex (see https://github.com/absinthe-graphql/absinthe_tutorial/pull/2):
:jiffy.encode(data, [:use_nil])
I think a guide about running absinthe_tutorial with Nanobox will be useful. And a guide with Nanobox and Elm frontend for absinthe_tutorial as well.
@bruce What do you think about it? And do you prefer Elm FE with basic HTML or only writing GraphQL responses to console.log?