This repository contains a sample application built using,
Apollo
Prisma
TypeScript
MySQL
The dataset used is the Sakila sample database.
This application includes the following features:
- Implementation of GraphQL queries (with arguments)
- Data manipulation using the Sakila dataset
- Clone the repository:
git clone https://github.com/wf001/graphql-sakila.git
- Execute the SQL files in the
db/init
directory sequentially to set up the Sakila database.
cd graphql-sakika
mysql -u (your_db_username) < db/init/01-sakila-schema.sql
mysql -u (your_db_username) < db/init/02-sakila-dataset.sql
- Install dependencies:
yarn install
- Creat env file on root
DATABASE_URL="mysql://(USERNAME):(USER_PASSWORD)@localhost:(PORT)/sakila"
To start the server, run the following command:
yarn start
This will start the server, and you'll be able to access the GraphQL endpoint(default is localhost:4000
).
Here's an example of the queries supported by the server:
query GetCountry($cityId: Int!) {
getCity(city_id: $cityId) {
city
city_id
country {
country
country_id
}
}
}
MIT License