Skip to content

Contains a sample GraphQL implementation built with Apollo, TypeScript, and MySQL. The datasets is Sakila.

Notifications You must be signed in to change notification settings

wf001/apollo-prisma-mysql-sakila

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Sakila Example

This repository contains a sample application built using,

  • Apollo
  • Prisma
  • TypeScript
  • MySQL

The dataset used is the Sakila sample database.

Overview

This application includes the following features:

  • Implementation of GraphQL queries (with arguments)
  • Data manipulation using the Sakila dataset

Setup

  1. Clone the repository:
git clone https://github.com/wf001/graphql-sakila.git
  1. 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
  1. Install dependencies:
yarn install
  1. Creat env file on root
DATABASE_URL="mysql://(USERNAME):(USER_PASSWORD)@localhost:(PORT)/sakila"

Usage

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).

Query Examples

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
    }
  }
}

License

MIT License

About

Contains a sample GraphQL implementation built with Apollo, TypeScript, and MySQL. The datasets is Sakila.

Topics

Resources

Stars

Watchers

Forks