1
0
mirror of https://github.com/actix/examples synced 2025-01-22 22:05:57 +01:00

35 lines
904 B
Markdown
Raw Normal View History

2022-02-17 21:29:55 +00:00
# GraphQL using Juniper and MySQL
2022-02-17 20:59:04 +00:00
GraphQL Implementation in Rust using Actix, Juniper, and MySQL as Database
2021-04-26 20:32:32 +09:00
## Prerequisites
2022-02-17 20:59:04 +00:00
- MySQL server
2021-04-26 20:32:32 +09:00
## Database Configuration
2022-02-17 20:59:04 +00:00
Create a new database for this project, and import the existing database schema has been provided named `mysql-schema.sql`.
2022-02-17 20:59:04 +00: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.
2022-02-17 20:59:04 +00:00
```sh
cat mysql-schema.sql | mysql -u root -D graphql_testing
```
## Usage
```sh
cd graphql/juniper-advanced
2022-02-17 20:59:04 +00:00
cp .env.example .env
# edit .env and insert your DB credentials
cargo run
```
2021-04-26 20:32:32 +09:00
## GraphQL Playground
2022-02-17 20:59:04 +00: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
```