Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juffalow/express-graphql-example
Example project how to use Express and GraphQL. You can find working example with frontend at https://quotes.juffalow.com
https://github.com/juffalow/express-graphql-example
example-project express graphql knexjs nodejs sql typescript
Last synced: about 2 hours ago
JSON representation
Example project how to use Express and GraphQL. You can find working example with frontend at https://quotes.juffalow.com
- Host: GitHub
- URL: https://github.com/juffalow/express-graphql-example
- Owner: juffalow
- License: mit
- Created: 2017-07-19T22:31:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-30T12:20:24.000Z (about 1 month ago)
- Last Synced: 2024-10-30T03:41:52.301Z (14 days ago)
- Topics: example-project, express, graphql, knexjs, nodejs, sql, typescript
- Language: TypeScript
- Homepage: https://graphql.juffalow.com/graphql
- Size: 784 KB
- Stars: 248
- Watchers: 8
- Forks: 75
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Express, GraphQL example
[![License](https://img.shields.io/badge/License-MIT-blue.svg?maxAge=2592000)](https://github.com/juffalow/express-graphql-sequelize-example/blob/master/LICENSE)
[![](https://github.com/juffalow/express-graphql-example/workflows/Lint/badge.svg)](https://github.com/juffalow/express-graphql-example/actions)
[![](https://github.com/juffalow/express-graphql-example/workflows/Test/badge.svg)](https://github.com/juffalow/express-graphql-example/actions)
[![codecov](https://codecov.io/gh/juffalow/express-graphql-example/branch/master/graph/badge.svg)](https://codecov.io/gh/juffalow/express-graphql-example)![out](https://user-images.githubusercontent.com/8142965/56870885-6e11dd00-6a16-11e9-8bba-230476808af2.png)
## How to run the project using Docker
```shell
docker-compose up --build
```Open GraphiQL in your browser [http://localhost:3010/graphql](http://localhost:3010/graphql)
## How to run the project
Install dependencies:
```shell
yarn# or using npm
npm install
```Create `src/config.ts` or rename `src/config.example.js` and update file with your credentials:
```js
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:
```shell
yarn start# or using npm
npm start
```Open GraphiQL in your browser [http://localhost:3010/graphql](http://localhost:3010/graphql)
## Examples
You can find example queries in [EXAMPLES.md](./EXAMPLES.md).
## Old version
Here is a link to an old version, that used `sequelize` and did not use connections:
* [1.4.0](https://github.com/juffalow/express-graphql-sequelize-example/tree/1.4.0)Here is a link to older version, that did not use typescript, and used `buildSchema` method and graphql schema file:
* [2.0.0](https://github.com/juffalow/express-graphql-example/tree/2.0.0)Here is a link to older version, that used typescript version `4.x` and `graphql-express` package to handle GrahpQL requests:
* [3.3.0](https://github.com/juffalow/express-graphql-example/tree/3.3.0)## License
[MIT license](./LICENSE)