https://github.com/kareraolivier/flashcard_backend
This repository contain api for flash card app
https://github.com/kareraolivier/flashcard_backend
apollo-server-express graphql nodejs prisma typescript
Last synced: about 2 months ago
JSON representation
This repository contain api for flash card app
- Host: GitHub
- URL: https://github.com/kareraolivier/flashcard_backend
- Owner: kareraolivier
- Created: 2022-07-27T09:31:27.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-11T07:59:50.000Z (over 2 years ago)
- Last Synced: 2025-06-06T01:04:55.541Z (about 1 year ago)
- Topics: apollo-server-express, graphql, nodejs, prisma, typescript
- Language: TypeScript
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL Server Example (SDL-first)
This example shows how to implement an **GraphQL server (SDL-first) with TypeScript** with the following stack:
- [**Apollo Server**](https://www.apollographql.com/docs/apollo-server): HTTP server for GraphQL APIs
- [**Prisma Client**](https://www.prisma.io/docs/concepts/components/prisma-client): Databases access (ORM)
- [**Prisma Migrate**](https://www.prisma.io/docs/concepts/components/prisma-migrate): Database migrations
- [**SQLite**](https://www.sqlite.org/index.html): Local, file-based SQL database
## Getting started
### 1. Download example and install dependencies
Download this example:
```
curl https://codeload.github.com/prisma/prisma-examples/tar.gz/latest | tar -xz --strip=2 prisma-examples-latest/typescript/graphql-sdl-first
```
Install npm dependencies:
```
cd graphql-sdl-first
npm install
```
Alternative: Clone the entire repo
Clone this repository:
```
git clone git@github.com:prisma/prisma-examples.git --depth=1
```
Install npm dependencies:
```
cd prisma-examples/typescript/graphql-sdl-first
npm install
```
### 2. Create and seed the database
Run the following command to create your SQLite database file. This also creates the `User` and `Post` tables that are defined in [`prisma/schema.prisma`](./prisma/schema.prisma):
```
npx prisma migrate dev --name init
```
When `npx prisma migrate dev` is executed against a newly created database, seeding is also triggered. The seed file in [`prisma/seed.ts`](./prisma/seed.ts) will be executed and your database will be populated with the sample data.
### 3. Start the GraphQL server
Launch your GraphQL server with this command:
```
npm run dev
```
Navigate to [http://localhost:4000](http://localhost:4000) in your browser to explore the API of your GraphQL server in a [GraphQL Playground](https://github.com/prisma/graphql-playground).
- Check out the [Prisma docs](https://www.prisma.io/docs)
- Share your feedback in the [`prisma2`](https://prisma.slack.com/messages/CKQTGR6T0/) channel on the [Prisma Slack](https://slack.prisma.io/)
- Create issues and ask questions on [GitHub](https://github.com/prisma/prisma/)
- Watch our biweekly "What's new in Prisma" livestreams on [Youtube](https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w)