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.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
A step by step series of examples that tell you how to get a development env running
Clone the repository
git clone https://github.com/harundogdu/typescript-prisma-library-API.git
Install dependencies
npm install
Run the development server
npm run dev
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 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.
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 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).
The following endpoints are available in this API. You can use Postman to test them.
Prefix | Description |
---|---|
/api/v1 | API |
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 |
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 |
- Typescript
- Prisma
- Express
- Nodemon
- Ts-Node
- Ts-Node-Dev
- Tsconfig-Paths
- Esbuild
- Esbuild-Register
- Dotenv
- Cors
- Express-Validator
- Prisma schema file with Book and Author models
- Book endpoints CRUD operations
- Author endpoints CRUD operations
- Error handling
- Prisma seed database script
- Prisma fresh script
- Swagger API documentation
- Pagination & Sorting
- JWT authentication
- Rate limiting
- Dockerize the API
This project is licensed under the MIT License - see the LICENSE.md file for details