Tarantool GraphQL API module
General description
Module based on:
- Tarantool 2.8.4+
- Tarantool Cartridge 2.7.4+
- Tarantool Graphql 0.1.4+
- Tarantool DDL 1.6.0+
- Tarantool VShard 0.1.19+
- Tarantool Checks 3.1.0+
- Tarantool Errors 2.2.1+
- Tarantool GraphQLIDE 0.0.21+
CAUTION: Since this module is under heavy development it is not recommended to use on production environments and also API and functionality in future releases may be changed without backward compatibility!
Install pre-built rock
Simply run from the root of Tarantool App root the following:
cd <tarantool-application-dir>
tarantoolctl rocks install graphqlapi
Lua API
GraphQL API module has a several submodules. Each of submodule has an API that described in the following docs:
- graphqlapi
- graphqlapi.cluster
- graphqlapi.defaults
- graphqlapi.fragments
- graphqlapi.helpers
- graphqlapi.middleware
- graphqlapi.operations
- graphqlapi.schemas
- graphqlapi.types
Simple start
- Install the following modules to your app:
cd <tarantool-application-dir>
# install GraphQL IDE
tarantoolctl rocks install graphqlide
# install GraphQL API
tarantoolctl rocks install graphqlapi
# install GraphQL API Helpers (available only for Tarantool Enterprise SDK users)
tarantoolctl rocks install graphqlapi-helpers
- Add dependent roles to router custom role:
...
dependencies = {
...
'cartridge.roles.graphqlide',
'cartridge.roles.graphqlapi',
},
...
- Add helpers to init() router custom role:
local function init(opts) -- luacheck: no unused args
-- if opts.is_master then
-- end
spaces.init({ schema = 'Spaces' })
data.init({ schema = 'Data' })
return true
end
- Add custom fragments (if need some) to
./fragments
dir.
Examples
For simple example of using this module refer to: GraphQL API simple example
For fully featured example of using this module refer to: GraphQL API full featured example