https://github.com/awebcode/express-ts-prisma-tutorial
https://github.com/awebcode/express-ts-prisma-tutorial
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/awebcode/express-ts-prisma-tutorial
- Owner: awebcode
- Created: 2024-11-02T09:39:32.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-02T09:59:36.000Z (about 1 year ago)
- Last Synced: 2025-03-16T16:45:38.637Z (11 months ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs-bun
# Key Features of This Implementation:
- Express Setup: Basic Express server setup with JSON body parsing.
- Prisma & POSTGRESQL
- MVC Architecture
- CRUD Operations: Handlers for creating, reading, updating, and deleting Book items.
- UUID Handling: Uses UUIDs for the id field.
- Zod Validation: Validates incoming requests to - - - ensure that the title is provided and that it meets specified criteria.
Error Handling: Includes basic error handling for not found routes and general errors.
Running the Server
Ensure you have your PostgreSQL database running and the DATABASE_URL environment variable set up correctly in your .env file.
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run index.ts
```
This project was created using `bun init` in bun v1.1.26. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
## npx prisma migrate dev --name create-book
npx prisma generate
Start the server:
## npx ts-node src/index.ts
(Assuming your server file is named index.ts and located in a src folder)