GitHub - rtsdeveloper/API_Development
Repository navigation
API_DevelopmentPublic
About
No description, website, or topics provided.Resources
Readme ActivityStars
0 starsWatchers
1 watchingForks
0 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
1 Commit
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| lib | lib | ||
| middleware | middleware | ||
| prisma | prisma | ||
| routes | routes | ||
| scripts | scripts | ||
| .gitignore | .gitignore | ||
| package.json | package.json | ||
| readme.md | readme.md | ||
| server.js | server.js | ||
| yarn.lock | yarn.lock | ||
Repository files navigation
Run this project (existing repo)
Prerequisites
- Node.js >= 16
- Yarn
- MySQL running and reachable
1) Install dependencies
yarn install
2) Configure environment
Create a .env file at the project root with your database URL:
DATABASE_URL="mysql://root:root@127.0.0.1:3306/mydb"
Ensure the database exists:
mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mydb;"
Connect to MySQL Shell:
\connect root@localhost:3306; USE mydb; SHOW TABLES; SHOW DATABASES; SELECT * FROM user;
3) Apply migrations and generate Prisma Client
yarn prisma migrate dev --name init
This applies the SQL in prisma/migrations/**/migration.sql and regenerates the Prisma client.
4) Start the server
yarn dev # uses nodemon # or yarn start # plain node
5) Prisma quick commands (Yarn)
yarn prisma:migrate:dev # Apply migrations in dev mode yarn prisma:migrate:deploy # Apply migrations in production yarn prisma:generate # Generate Prisma client yarn prisma:studio # Open Prisma Studio yarn prisma:db:push # Push schema without migrations