GraphQL implementation in Lua
#lua #graphql #server #library
|
il y a 9 ans | |
---|---|---|
graphql | il y a 9 ans | |
tests | il y a 9 ans | |
LICENSE | il y a 9 ans | |
README.md | il y a 9 ans | |
graphql.lua | il y a 9 ans | |
package.lua | il y a 9 ans |
Lua implementation of GraphQL parser using LPeg. Experimental.
Parsing queries:
local parse = require 'parse'
local ast = parse [[
query getUser {
firstName
lastName
}
]]
Creating schemas:
local schema = require 'schema'
local types = require 'types'
local person = types.object {
name = 'Person',
fields = {
firstName = types.string.nonNull
lastName = types.string.nonNull
}
}
local schema = schema.create {
query = types.object {
name = 'Query',
fields = {
person = person
}
}
}
Validating schemas:
local validate = require 'validate'
validate(schema, ast)
lua tests/runner.lua
MIT