Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I got nothing to do

Serabass Serabass

💭
I got nothing to do
  • Kazakhstan
View GitHub Profile
@Serabass
Serabass / require-gql.js
Last active Dec 6, 2018
Require GraphQL in Node
View require-gql.js
import * as fs from 'fs';
require.extensions['.gql'] = function (module, filename) {
const content = fs.readFileSync(filename).toString('utf-8');
module._compile(`
exports.default = ${JSON.stringify(content)}; // Здесь можно вызвать, например buildSchema и вернуть собранную схему.
`, filename);
};