An open API service indexing awesome lists of open source software.

https://github.com/harundogdu/typescript-prisma-library-api

This is a simple API built with Typescript, Prisma, and Express. It is a library API that allows users to create, read, update, and delete books and authors. It also allows users to create, read, update, and delete book authors.
https://github.com/harundogdu/typescript-prisma-library-api

api crud es-build express express-validator nodejs nodemon prisma rest-api typescript

Last synced: 30 days ago
JSON representation

This is a simple API built with Typescript, Prisma, and Express. It is a library API that allows users to create, read, update, and delete books and authors. It also allows users to create, read, update, and delete book authors.

Awesome Lists containing this project

README

        

## Typescript & Prisma & Express Library API

This is a simple API built with Typescript, Prisma, and Express. It is a library API that allows users to create, read, update, and delete books and authors. It also allows users to create, read, update, and delete book authors.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

A step by step series of examples that tell you how to get a development env running

Clone the repository

```bash
git clone https://github.com/harundogdu/typescript-prisma-library-API.git
```

Install dependencies

```bash
npm install
```

Run the development server

```bash
npm run dev
```

Available Scripts



  • npm run dev - Runs the app in the development mode.


  • npm run start - Runs the app in the production mode.


  • npm run fresh - Drops the database, creates a new one, and runs all migrations.


  • npx prisma db seed - Runs the seed file.

## Prisma

Prisma is an open-source database toolkit that makes it easy for developers to reason about their data and how they access it. It is used to query a database inside a Node.js or TypeScript application.

## Prisma Schema

The Prisma schema is the single source of truth for your database schema. It describes your database tables, columns, and relations. It also defines which operations are available on your data.

## Prisma Client

Prisma Client is an auto-generated and type-safe query builder for Node.js & TypeScript. It's used as an alternative to writing plain SQL, or using another database access tool such as SQL query builders (e.g. SQLAlchemy) or ORMs (e.g. TypeORM).

## Available Endpoints

The following endpoints are available in this API. You can use Postman to test them.

API Prefix

| Prefix | Description |
| ------- | ----------- |
| /api/v1 | API |

Books

| Method | Endpoint | Description |
| ------ | ---------- | ---------------- |
| GET | /books | Get all books |
| GET | /books/:id | Get a book by id |
| POST | /books | Create a book |
| PUT | /books/:id | Update a book |
| DELETE | /books/:id | Delete a book |

Authors

| Method | Endpoint | Description |
| ------ | ------------ | ------------------- |
| GET | /authors | Get all authors |
| GET | /authors/:id | Get an author by id |
| POST | /authors | Create an author |
| PUT | /authors/:id | Update an author |
| DELETE | /authors/:id | Delete an author |

## Built With

## TODO

- [x] Prisma schema file with Book and Author models
- [x] Book endpoints CRUD operations
- [x] Author endpoints CRUD operations
- [x] Error handling
- [x] Prisma seed database script
- [x] Prisma fresh script
- [x] Swagger API documentation
- [ ] Pagination & Sorting
- [ ] JWT authentication
- [ ] Rate limiting
- [ ] Dockerize the API

## Authors

## License

This project is licensed under the MIT License - see the LICENSE.md file for details