Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iskyd/node-graphql-sqlite
https://github.com/iskyd/node-graphql-sqlite
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/iskyd/node-graphql-sqlite
- Owner: iskyd
- Created: 2021-10-30T11:41:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-01T14:57:53.000Z (about 3 years ago)
- Last Synced: 2025-01-03T03:36:19.229Z (17 days ago)
- Language: JavaScript
- Size: 77.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node + GraphQL + SQLite
## _DATABASE_
Create an SQLite database: ./prisma/db.sqlite
```sh
CREATE TABLE author (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name text NOT NULL
);CREATE TABLE book (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name text NOT NULL,
author_id INT NOT NULL
);INSERT INTO author (id, name) VALUES
(1, "J. K. Rowling"),
(2, "J. R. R. Tolkien"),
(3, "Brent Weeks");INSERT INTO book (name, author_id) VALUES
("Harry Potter and the Chamber of Secrets", 1),
("Harry Potter and the Prisoner of Azkaban", 1),
("Harry Potter and the Goblet of Fire", 1),
("The Fellowship of the Ring", 2),
("The Two Towers", 2),
("The Return of the King", 2),
("The Way of Shadows", 3),
("Beyond the Shadows", 3);
```
## _INIT PRISMA_
```sh
npm install --include=dev
touch .env && echo "DATABASE_URL="file:./db.sqlite"" > .env
npx prisma generate
```## _RUN_
```sh
npm run devStart
```Then go to http://localhost:3000
## _TODO_
- ~~Update data~~
- ~~Delete data~~
- ~~Prisma ORM~~
- ~~Pagination~~
- ~~Pagination in subfields~~
- ~~Refactor in different files~~