→ كل المشاريع

clean-rest-apis

بواسطة @ipenywis

118

Best Practices to write clean RESTFUL APIs using Node.js and Express

عن هذا المشروع

REST API Example This example shows how to implement a REST API with TypeScript using Express and Prisma Client. The example uses an SQLite database file with some initial dummy data which you can find at ./prisma/dev.db. Getting started Download example and install dependencies Download this example: Install npm dependencies: Alternative: Clone the entire repo Clone this repository: Install npm dependencies: 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: When npx prisma migrate dev is executed against a newly created database, seeding is also triggered. The seed file in prisma/seed.ts will be executed and your database will be populated with the sample data. Start the REST API server The server is now running on http://localhost:3000. You can now run the API requests, e.g. http://localhost:3000/feed. Using the REST API You can access the REST API of the server using the following endpoints: GET /post/:id: Fetch a single post by its id /feed?searchString={searchString}&take={take}&skip={skip}&orderBy={orderBy}: Fetch all published posts

من ملف README الخاص بالمشروع على GitHub

النجوم
118
التفريعات
32
آخر تحديث
27/02/2023

أضف هذه الشارة إلى ملف README

أظهر أن مشروعك مُدرج على «صُنع في الجزائر».

Made in Algeria
[![Made in Algeria](https://www.madeinalgeria.dev/badge/clean-rest-apis.svg)](https://www.madeinalgeria.dev/projects/clean-rest-apis)

مشاريع ذات صلة