55 </a >
66</p >
77
8- Starter for Node.js Express API in Typescript with jsonwebtoken, joi, Knex, Objection.js and many other popular tools.
8+ Starter for Node.js, Express API in Typescript and PostgreSQL with jsonwebtoken, joi, Knex, Objection.js and many other popular tools.
99
1010## Requirements
1111
@@ -16,8 +16,6 @@ Starter for Node.js Express API in Typescript with jsonwebtoken, joi, Knex, Obje
1616
1717## Getting Started
1818
19- Clone the repository, install the dependencies.
20-
2119``` bash
2220# Clone repository
2321$ git clone git@github.com:cham11ng/typescript-api-starter.git < application-name>
@@ -27,6 +25,9 @@ $ cd <application-name>
2725# Update database credentials
2826$ cp .env.example .env
2927
28+ # Install dependencies
29+ $ yarn install
30+
3031$ yarn migrate
3132```
3233
@@ -53,60 +54,54 @@ $ yarn dev
5354 <a href =" https://imgur.com/gallery/4rhTo " ><img src =" https://i.imgur.com/GpcDbLB.gif " /></a >
5455</p >
5556
56- ** Using Docker**
57-
58- Make a copy of ` .env.docker ` and save as ` .env ` .
57+ ### Using Docker
5958
6059``` bash
60+ # Make a copy of `.env.docker` and save as `.env`.
6161$ cp .env.docker .env
6262```
6363
6464Install dependencies and run the application locally.
6565
6666``` bash
67- $ docker compose up -d postgres
68-
6967$ docker compose up -d api
7068
71- $ docker compose exec api sh yarn migrate # Make sure server is started checking logs before running this command
69+ # Make sure server is started checking logs before running this command
70+ $ docker compose exec api sh yarn migrate
7271```
7372
74- View logs of the container.
75-
7673``` bash
77- $ docker compose logs -f
78- ```
74+ # View logs of the container.
75+ $ docker compose logs -f api
7976
80- To stop the services.
81-
82- ``` bash
77+ # To stop the services.
8378$ docker compose stop api postgres
8479```
8580
8681## Generating Migrations and Seeds
8782
88- To create migration use ` make:migration ` and seed use ` make:seeder ` :
89-
9083``` bash
84+ # To create migration use `make:migration`
9185$ yarn make:migration create_{table_name}_table
9286
87+ # To create seed use `make:seeder`
9388$ yarn make:seeder {table_name}_table_seeder
9489```
9590
96- Example,
97-
9891``` bash
92+ # Example
9993$ yarn make:migration create_posts_table
100-
10194$ yarn make:seeder post_table_seeder
10295```
10396
10497Modify migration and seeder file as per the requirement. Then finally:
10598
10699``` bash
107- $ yarn migrate # to migrate
100+ # to migrate
101+ $ yarn migrate
108102
109- $ yarn seed # to seed
103+ # to seed
104+ $ yarn seed
110105```
111106
112107## Setting up REST Client
@@ -120,7 +115,7 @@ Create a file or add following lines in `.vscode` > `settings.json` and switch a
120115 "refreshToken" : " foo" ,
121116 "accessToken" : " bar" ,
122117 "email" : " sgr.raee@gmail.com" ,
123- "password" : " secret"
118+ "password" : " secret"
124119 },
125120 "local" : {
126121 "host" : " localhost" ,
0 commit comments