This is a showcase for Absinthe
-
Battery included
- You can soon try it in Docker Compose.
-
Written in the latest libraries:
- OTP 21, Elixir 1.7.4
- Phoenix 1.4, Ecto 3.0
- Absinthe 1.4.13
-
Avoiding N+1 problem with dataloader
-
Authorizing user permission with a custom middleware
-
Count the number of records regardless of LIMIT/OFFSET specified, which is very useful in pagination
-
Supports multistage query such as
{questions{users{} answers{}}}
,{me {users{} questions{} answers{}}}
,{questions{answers{users{}}}}
, etc. -
Various queries/mutations
- mutations
- login with email and password; supports two permissions
- normal user
- admin user
- create user account
- only admin user can create new accounts
- guests(no login user) or normal users are rejected
- login with email and password; supports two permissions
- query
- various queries includes total record counts
- mutations
- build docker compose
- setup table and seed data
mix deps.get && mix deps.compile
mix ecto.setup
- access graphiql
http://localhost:5001/graphiql
- Enjoy!
- Notice
- users.plain_pasword: raw password(not hashed) on purpose
- users.permission: 0 = normal user, 1 = admin user
- all tables, user, question and answer, have
total_count
field as a virtual field. In casetotalCount
is specified, the count willl be stored in the field.