2022-02-17 22:29:55 +01:00
# GraphQL using Juniper and MySQL
2019-12-07 15:16:46 +01:00
2022-02-17 21:59:04 +01:00
GraphQL Implementation in Rust using Actix, Juniper, and MySQL as Database
2019-12-07 15:16:46 +01:00
2021-04-26 13:32:32 +02:00
## Prerequisites
2022-02-17 21:59:04 +01:00
- MySQL server
2019-12-07 15:16:46 +01:00
2021-04-26 13:32:32 +02:00
## Database Configuration
2019-12-07 15:16:46 +01:00
2022-02-17 21:59:04 +01:00
Create a new database for this project, and import the existing database schema has been provided named `mysql-schema.sql` .
2019-12-07 15:16:46 +01:00
2022-02-17 21:59:04 +01:00
Create `.env` file on the root directory of this project and set environment variable named `DATABASE_URL` , the example file has been provided named `.env.example` , you can see the format in there.
2019-12-07 15:16:46 +01:00
2022-02-17 21:59:04 +01:00
```sh
cat mysql-schema.sql | mysql -u root -D graphql_testing
```
## Usage
2019-12-07 15:16:46 +01:00
```sh
2021-10-06 23:28:53 +02:00
cd graphql/juniper-advanced
2022-02-17 21:59:04 +01:00
cp .env.example .env
# edit .env and insert your DB credentials
2019-12-07 15:16:46 +01:00
cargo run
```
2021-04-26 13:32:32 +02:00
## GraphQL Playground
2019-12-07 15:16:46 +01:00
2022-02-17 21:59:04 +01:00
GraphQL provides its own documentation. Click the "docs" link in the top right of the GraphiQL UI to see what types of queries and mutations are possible.
```
http://localhost:8080/graphiql
2021-10-06 23:28:53 +02:00
```