Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/therebelrobot/aeros
🦅Low-friction GraphQL schemas
https://github.com/therebelrobot/aeros
Last synced: 9 days ago
JSON representation
🦅Low-friction GraphQL schemas
- Host: GitHub
- URL: https://github.com/therebelrobot/aeros
- Owner: therebelrobot
- License: mit
- Created: 2017-04-28T21:59:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T18:19:02.000Z (over 7 years ago)
- Last Synced: 2024-12-17T03:24:49.506Z (24 days ago)
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aeros
Simplified GraphQL Schema generation, built on [`graphql-tools`](https://github.com/apollographql/graphql-tools)## Overview
**Aeros** simplifies GraphQL schemas by colocating schema definition and resolvers in a single, lintable and testable, js file. This allows you to build and scale GraphQL schemas as you would the resources they talk to, without having to worry that your schemas and your resolvers aren't matching somewhere.
## Quickstart
All you need are two files: `schema.js` (the Aeros implementation) and `index.js` (in this example, a graphql-server-micro installation)
```bash
// install aeros
npm i -s aeros// install supporting libraries for quickstart
npm i -s graphql-server-micro micro microrouter
``````js
// schema.js
const Aeros = require('aeros')const query = {
user: {
type: 'User',
params: {
id: 'String'
},
resolver: (_, { id }, ctx) => {
return { id, email: '[email protected]', name: 'Jane Doe' }
}
}
}const types = {
User: {
id: 'String!',
email: 'String',
name: 'String',
address: {
type: 'String',
resolver: (user, _, ctx) => {
return '350 Awesome St. Exampleville, CA'
}
}
}
}module.exports = Aeros({ query, types }).schema
``````js
// index.js - taken from graphql-server-micro
const { microGraphiql, microGraphql } = require("graphql-server-micro")
const micro = require("micro")
const { send } = micro
const { get, post, router } = require("microrouter")
const schema = require("./schema")
const graphqlHandler = microGraphql({ schema });
const graphiqlHandler = microGraphiql({ endpointURL: "/graphql" });
const server = micro(
router(
get("/graphql", graphqlHandler),
post("/graphql", graphqlHandler),
get("/graphiql", graphiqlHandler),
(req, res) => send(res, 404, "not found"),
),
);
server.listen(3000);
```You should see a working graphiql interface on http://localhost:3000/graphiql.
## API Documentation
## Tutorials and Walkthroughs (for prototypical projects)
## Demos
## License
[MIT](https://tldrlegal.com/license/mit-license)