Skip to content

Commit 75b0858

Browse files
committed
docs: 📝 document updated
1 parent 7cf83cd commit 75b0858

File tree

2 files changed

+48
-20
lines changed

2 files changed

+48
-20
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ DB_HOST=localhost
22
DB_NAME=name
33
DB_PASSWORD=password
44
DB_PORT=3306
5-
DB_TYPE=mysql
5+
DB_TYPE=postgres
66
DB_USER=username
77
PORT=5000
88

README.md

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A boilerplate/starter project for quickly building RESTful APIs using Node.js,Ty
2929

3030
create boillerplate with single command
3131

32-
```
32+
```sh
3333
npx @nabadeep25/create-ts-node-app myapp
3434

3535
```
@@ -42,7 +42,7 @@ steps:
4242

4343
Clone the repo:
4444

45-
```
45+
```sh
4646
git clone --depth 1 https://github.com/nabadeep25/typescript-node-sequelize-boilerplate.git foldername
4747

4848
cd folder name
@@ -51,19 +51,19 @@ npx rimraf ./.git
5151

5252
Install the dependencies:
5353

54-
```
54+
```sh
5555
npm install
5656
```
5757

5858
Set the environment variables:
5959

60-
```
60+
```sh
6161
cp .env.example .env
6262

6363
```
6464
## Getting started
6565

66-
```
66+
```sh
6767
npm install
6868

6969
npm run build-ts
@@ -74,20 +74,20 @@ npm start
7474

7575
## For development
7676

77-
```
77+
```sh
7878
npm install
7979

80-
npm run watch
80+
npm run dev
8181

8282
```
8383

8484
## Sample .ENV
85-
```
85+
```sh
8686
DB_HOST=localhost
8787
DB_NAME=name
8888
DB_PASSWORD=password
8989
DB_PORT=3306
90-
DB_TYPE=mysql
90+
DB_TYPE=postgres
9191
DB_USER=username
9292
PORT=5000
9393

@@ -114,7 +114,7 @@ OTP_SECRET=shgdbnbgw
114114

115115
```bash
116116
# run in development
117-
npm run watch
117+
npm run dev
118118

119119
# run in production
120120
npm run start
@@ -147,7 +147,31 @@ src\
147147
|--app.ts\ # Express app
148148
|--server.ts\ # App entry point
149149
```
150-
150+
## Changing Database
151+
152+
### step 1
153+
154+
```sh
155+
# Change the value of DB_TYPE in .env file to one of the follwing
156+
DB_TYPE=postgres
157+
DB_TYPE=mysql
158+
DB_TYPE=sqlite
159+
DB_TYPE=mariadb
160+
DB_TYPE=mssql
161+
DB_TYPE=db2
162+
DB_TYPE=oracle
163+
```
164+
### step 2
165+
```sh
166+
# Install one of the related packge:
167+
npm install --save pg pg-hstore # for Postgres
168+
npm install --save mysql2 # for Mysql
169+
npm install --save mariadb # for Mariadb
170+
npm install --save sqlite3 # for Sqlite
171+
npm install --save tedious # for Microsoft SQL Server (mssql)
172+
npm install --save oracledb # for Oracle
173+
```
174+
for more details please refer [Sequelize](https://sequelize.org/docs/v6/getting-started/)
151175
## API Documentation
152176

153177
To view the list of available APIs and their specifications, run the server and go to `http://localhost:5000/api/v1/docs` in your browser. This documentation page is automatically generated using the [swagger](https://swagger.io/) definitions written as comments in the route files.
@@ -156,16 +180,20 @@ To view the list of available APIs and their specifications, run the server and
156180

157181
List of available routes:
158182

159-
**Auth routes**:
160-
`POST api/v1/auth/register` - register
161-
`POST api/v1/auth/login` - login
162-
`POST api/v1/auth/forgot-password` - send reset password email
163-
`POST api/v1/auth/reset-password` - reset password
183+
**General routes**: <br>
184+
`GET api/` - get server status <br>
185+
`PATCH api/sync` - Sync model with database <br>
186+
187+
**Auth routes**: <br>
188+
`POST api/v1/auth/register` - register <br>
189+
`POST api/v1/auth/login` - login <br>
190+
`POST api/v1/auth/forgot-password` - send reset password email <br>
191+
`POST api/v1/auth/reset-password` - reset password <br>
164192

165193

166-
**User routes**:
167-
`GET api/v1/user` - get user info
168-
`PATCH api/v1/user` - update user
194+
**User routes**: <br>
195+
`GET api/v1/user` - get user info <br>
196+
`PATCH api/v1/user` - update user <br>
169197

170198

171199

0 commit comments

Comments
 (0)