Skip to content

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.

Notifications You must be signed in to change notification settings

harundogdu/typescript-prisma-library-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Install dependencies

npm install

Run the development server

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

  • 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

Authors

License

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

About

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.

Topics

Resources

Stars

Watchers

Forks