Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lazhari/hacker-news-api
Hacker new API clone using Prisma and graphql-yoga
https://github.com/lazhari/hacker-news-api
docker docker-compose graphql-server graphql-yoga hacker-news-api healthcheck mysql prisma prisma-cli
Last synced: about 2 months ago
JSON representation
Hacker new API clone using Prisma and graphql-yoga
- Host: GitHub
- URL: https://github.com/lazhari/hacker-news-api
- Owner: Lazhari
- Created: 2019-05-08T21:08:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T11:06:22.000Z (about 2 years ago)
- Last Synced: 2023-03-23T02:27:33.474Z (almost 2 years ago)
- Topics: docker, docker-compose, graphql-server, graphql-yoga, hacker-news-api, healthcheck, mysql, prisma, prisma-cli
- Language: JavaScript
- Size: 1.96 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hacker news API
This Project is my implementation of [how to graphql course](https://www.howtographql.com/) for Node.js and Prisma based on [graphql-yoga](https://github.com/prisma/graphql-yoga) and [prisma](https://www.prisma.io/).
## How to use
### 1. Get the project and install the dependencies
Clone the repository:
```bash
git clone https://github.com/Lazhari/hacker-news-api.git
```Install Node dependencies
```bash
cd hacker-news-api
yarn
```### 2. Install the Prisma CLI
To run the server, you need the Prisma CLI. Please install it via NPM
```bash
npm install -g prisma
```### 3. Set up database & deploy Prisma datamodel
```bash
prisma deploy
```### 4. Start the GraphQL server
Launch your GraphQL server with this command:
```bash
npm run start
```## Use Compose for dev environment
### Run prisma deploy from docker-compose
```bash
docker-compose run api prisma deploy
```### Run docker-compose up ⚡ to start app
```bash
docker-compose up
```### Running prisma with docker-compose exec
When you update your prisma models, you need to deploy that to prisma. Then you can run this command:
```bash
docker-compose exec api prisma deploy
```Navigate to [http://localhost:4000](http://localhost:4000) in your browser to explore the API of you GraphQL server in a [GraphQL Playground](https://github.com/prisma/graphql-playground).