@24hr/ettapi
v0.0.104-beta
Published
GraphQL API to stitch together the all services and create an ultragraph
Downloads
36
Maintainers
Keywords
Readme
ETT API Service
This npm module / Docker Image will stitch remote graphql schemas into a "ultragraph". It support Graphql Uploads. It will try to fetch remote schemas (wich need to allow introspective) and will stich everything.
How to use it as a npm module
npm install @24hr/ettapi -S -E
Then, just create your config ans send it to the init
function:
import { init } from '@24hr/ettapi';
import { config } from './config';
(async () => {
const { app } = await init({ config } );
app.listen(8080, () => {
console.log(`API listening on port 8080`);
});
})();
(or, with super modern nodejs, you dont need the async function).
and of course config.ts
or config.js
(as an example):
export const config = {
version: '1.0.0',
reloadInterval: process.env.NODE_ENV === 'development' ? 5000 : 30000,
list: [
{
name: 'content',
url: 'https://graphqlzero.almansi.me/api',
prefix: 'content_'
}
]
};
Tests
npm run test
Config for the docker image
{
"reloadInterval": 5000,
"list": [
{
"name": "Movies!",
"url": "http://localhost:8008/graphql",
"prefix": "movies_"
},
{
"name": "Books!",
"url": "http://localhost:8009/graphql",
"prefix": "books_"
}
]
}
Docker
docker run -v pathtoyourconfigfile.json:/app/config.json 24hrservice/ettapi