Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kang-theo/beautiful-todos-server
Server-side of a decoupled frontend and backend project based on Node.js, Express, TypeScript, MVC, Prisma ORM, MySQL, etc.
https://github.com/kang-theo/beautiful-todos-server
express jest mvc-architecture mysql nodejs prisma swagger typescript zod
Last synced: 3 days ago
JSON representation
Server-side of a decoupled frontend and backend project based on Node.js, Express, TypeScript, MVC, Prisma ORM, MySQL, etc.
- Host: GitHub
- URL: https://github.com/kang-theo/beautiful-todos-server
- Owner: kang-theo
- Created: 2024-02-03T12:50:08.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-09T17:29:48.000Z (11 months ago)
- Last Synced: 2024-11-13T15:55:44.827Z (2 months ago)
- Topics: express, jest, mvc-architecture, mysql, nodejs, prisma, swagger, typescript, zod
- Language: TypeScript
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Beautiful TODOs API Server
## Features
- ✔ Express framework
- ✔ MVC architecture
- ✔ TypeScript support
- ✔ Prisma ORM (MySQL)
- ✔ Customize error, log and catch all error
- Swagger document support
- Zod schema validation
- Rate limit
- Schema validation with zod
- Jest unit test## How to run?
### Setup
Pull the code and create `.env` in server root directory, the content likes below
```.env
DATABASE_URL="mysql://{username}:{password}@localhost:3306/beautiful-todos?connection_limit=5"
```If you use Postgres, please change the connection link
### Install
Enter the server directory and execute the below command
```bash
npm install
```### Run the application
Enter the server directory and execute the below command
```bash
npm start
```# Initialize the project from scratch
## NPM, Typescript and Express
* npm init -y
* npm install express
* npm i -D typescript ts-node nodemon @types/node @types/express
* npx tsc --init
* touch index.ts## Prisma
* npm install -D prisma
* npm install prisma-client | npx prisma generate
* npx prisma db push: Outside prisma migration system)
* npx prisma migrate dev --name : After updating the Prisma schema, generate a new migration
* npx prisma migrate deploy: Apply the generated migration to bring your database schema in sync
* npx prisma migrate dev: Check if the drift issue persists
* npx prisma generate: Regenerate the Prisma Client to reflect the changes in your schema