/node-graphql-frameworkless

Drop-in template/boilerplate for plain frameworkless Node.js+GraphQL server application start

Primary LanguageJavaScriptMIT LicenseMIT

Drop-in template/boilerplate for plain/frameworkless Node.js+GraphQL server application start

Simple GraphQL API Node.js application — is the best usage case of the template.

How to install and use

To install

git clone https://github.com/app/node-graphql-frameworkless.git my-best-app
cd my-best-app
rm -Rf .git && git init && git add . && git commit -m Import
npm i

To run

npm run dev

To run hello graphql query

./run-gql.sh hello.gql

Server's schema introspection query

./utils/get-schema.sh

Main features

  • Command line oriented development. No IDE, no framework, just your faivorite code editor and powerful set of tools
  • Hot page and resource reloading while code editing in development mode
  • No paths in imports. Just dependency name for vendor libs as well as your modules located in app/node_modules folder for Node’s dependencies resolution algorithm

Folders structure

  • /app — server side application code folder
  • /app/node_modules - place your server modules here
  • /deploy — files and guides for server app deployment

How to use in development

Add your code modules inside /app/node_modules/ folder
Import modules GraphQL types and resolvers in ./app/server.js
Start you server app with

npm run dev

How to use for production

If you planning docker deployment

npm start

Or setup and start systemd service with this example

Troubleshooting

Safe Write

Some text editors and IDE's have a feature called safe write that basically prevents data loss, by taking a copy of the file and renaming it when saved.

This feature blocks the automatic detection of file updates. To disable safe write use the options provided below:

  • Sublime Text 3 add atomic_save: "false" to your user preferences.
  • IntelliJ use search in the preferences to find "safe write" and disable it.
  • Vim add :set backupcopy=yes to your settings.
  • WebStorm uncheck Use "safe write" in Preferences > Appearance & Behavior > System Settings.

References