Example project how to use Express and GraphQL

Express, GraphQL example

out

How to run the project

Install dependencies:

yarn

# or using npm

npm install

Create src/config.ts or rename src/config.example.js and update file with your credentials:

export default {
  port: 3010,
  database: {
    type: 'mysql',
    connection: {
      database : '',
      host : '',
      password : '',
      user : '',
    },
    /*
     * Migrations run on every start of the application.
     * If you initialized the database manually (from the database.sql file),
     * you don't need this.
     */
    migrations: {
      directory: __dirname + '/migrations',
    },
  },
};

Run the project:

yarn start

# or using npm

npm start

Open GraphiQL in your browser http://localhost:3010/graphql

Examples

You can find example queries in EXAMPLES.md.

Old version

Here is a link to an old version, that used sequelize and did not use connections:

Here is a link to older version, that did not use typescript, and used buildSchema method and graphql schema file:

Download Details:

Author: juffalow

Source Code: https://github.com/juffalow/express-graphql-example

#nodejs #node #javascript #express #graphql

Example project how to use Express and GraphQL
6.65 GEEK