Skip to content

Simple package to import .graphql files to being able to write them with syntax highlighting.

License

Notifications You must be signed in to change notification settings

federico-moretti/require-graphql-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

require-graphql-file

Simple package to import .graphql files to being able to write them with syntax highlighting.

Installation

Via npm:

$ npm install --save require-graphql-file

Get started

Just require the .graphql file and use it like a normal string.

const requireGraphQLFile = require('require-graphql-file');

// the file is 'schema.graphql' but you can avoid to type the extension
const typeDefs = requireGraphQLFile('./schema');

// then use the schema as usual
// like in this example with Apollo
exports.schema = makeExecutableSchema({
  typeDefs,
  resolvers,
});

License

MIT © Federico Moretti

About

Simple package to import .graphql files to being able to write them with syntax highlighting.

Resources

License

Stars

Watchers

Forks

Packages

No packages published