quture-app
A package to create GraphQL apis in seconds
Introduction
The package exports a default class that loads Quture
based plugins.
Documentation can be found here.
Basic usage
const path = require('path');
const Config = require('quture-config');
const Quture = require('quture-app');
let application = new Quture({
rootDir: __dirname
});
// Get the router
let router = application.getRouter();
router.get(function(req, res, next) {
let ctx = router.getContext(req); // It is possible to get the context of the global router
res.json({
hello: "world"
});
});
// Creating a router
let customRouter = application.createRouter(); // This is simply an express router with some added functionality such as a context
router.get(function(req, res, next) {
let ctx = router.getContext(req); // It is possible to get the context of the custom router
});
// Bootstrap the application
let expressApp = application.bootstrap();
// This will return an express application with an error handler and everything
// already applied.
// Do what you want with this express application.
// Look at `quture-bootstrap` if you want to instantly bootstrap a web server