Learn how to connect Nest.js to PlanetScale MySQL database. The complete tutorial can be found here
git clone https://github.com/yemiwebby/nest-planetscale.git
npm install
Set up a free account on PlanetScale and create a new database. Obtain the username and password for your database branch. Follow the steps in this section of the tutorial.
Create a .env
file and populate using this command:
cp .env.example .env
Be sure to replace the following placeholders:
DATABASE_USER=USERNAME
DATABASE_PASSWORD=PASSWORD
DATABASE_NAME=DATABASE_NAME
DATABASE_HOST=DATABASE_HOST
Run the application with:
npm run start:dev
The API will start running default port http://localhost:3000
The endpoints are:
POST '/user/create'
GET '/user/all'
GET '/user/:userId'
PATCH '/user/edit/:userId'
DELETE '/user/delete/:userId'