Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
feat: add graphql for rss dumper (#2)
Browse files Browse the repository at this point in the history
* feat: change schema.prisma

* add prisma settings

* fix lint

* feat: add nexus prisma and other settings

* fix fmt

* fix build command
  • Loading branch information
s-hirano-ist authored Oct 30, 2023
1 parent 0f4e93f commit 46b898b
Show file tree
Hide file tree
Showing 19 changed files with 2,872 additions and 696 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/generated/nexus.ts
5 changes: 0 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ module.exports = {
"newlines-between": "never",
},
],
// FIXME: delete
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
},
root: true,
settings: {
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build/*
pnpm-lock.yaml
schema.graphql

53 changes: 4 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,19 @@

## Tech Stack

**GraphQL Server** - [Apollo Server](https://www.apollographql.com/docs/apollo-server/)
**GraphQL Server** - [Apollo Server](https://www.apollographql.com/docs/apollo-server/)
**GraphQL Schema Definition** - [GraphQL Nexus](https://nexusjs.org/docs/)
**ORM** - [Prisma](https://www.prisma.io/docs/)
**Database** - [PostgreSQL](https://www.postgresql.org/docs/)

## References

> https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-nexus
# GraphQL Server Example

This example shows how to implement a **GraphQL server with TypeScript** with the following stack:

- [**Apollo Server**](https://github.com/apollographql/apollo-server): HTTP server for GraphQL APIs
- [**GraphQL Nexus**](https://nexusjs.org/docs/): GraphQL schema definition and resolver implementation
- [**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

## Contents

- [Getting Started](#getting-started)
- [Using the GraphQL API](#using-the-graphql-api)
- [Evolving the app](#evolving-the-app)
- [Switch to another database (e.g. PostgreSQL, MySQL, SQL Server)](#switch-to-another-database-eg-postgresql-mysql-sql-server)
- [Next steps](#next-steps)

## Getting started

### 1. Download example and install dependencies

Download this example:

```
npx try-prisma@latest --template typescript/graphql-nexus
```

Install npm dependencies:

```
cd graphql-nexus
npm install
```

<details><summary><strong>Alternative:</strong> Clone the entire repo</summary>

Clone this repository:

```
git clone git@github.com:prisma/prisma-examples.git --depth=1
```

Install npm dependencies:

```
cd prisma-examples/typescript/graphql
npm install
```

</details>

### 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):
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
"scripts": {
"dev": "ts-node-dev --no-notify --respawn --transpile-only src/server",
"start": "node dist/server",
"clean": "rm -rf ./dist",
"build": "npm -s run clean && npm -s run generate && tsc",
"check:types": "tsc --noEmit",
"fmt": "prettier --check .",
"fmt:fix": "prettier --write .",
"lint": "eslint src/**/*.ts",
"lint:fix": "eslint src/**/*.ts --fix",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"nexus:generate": "ts-node --transpile-only src/schema",
"prisma:seed": "prisma db seed",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate dev",
"prisma:dev": "run-s -l prisma:generate prisma:migrate prisma:seed",
"prisma:studio": "prisma studio",
"postinstall": "prisma generate",
"generate": "npm -s run prisma:generate && npm -s run nexus:nexus"
"generate": "npm -s run prisma:generate && npm -s run nexus:generate"
},
"prisma": {
"seed": "ts-node --transpile-only prisma/seed.ts"
Expand All @@ -30,7 +31,8 @@
"@prisma/client": "5.5.2",
"graphql": "16.8.1",
"graphql-scalars": "1.22.4",
"nexus": "1.3.0"
"nexus": "1.3.0",
"nexus-prisma": "^2.0.1"
},
"devDependencies": {
"@types/node": "20.8.9",
Expand All @@ -39,6 +41,7 @@
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prisma": "5.5.2",
"ts-node": "10.9.1",
Expand Down
Loading

0 comments on commit 46b898b

Please sign in to comment.