Skip to content

Commit d5e7c7a

Browse files
committed
Enhanced README.md file with clear instructions
1 parent 6463f7f commit d5e7c7a

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

README.md

+42-18
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@
22

33
## Starting project
44

5-
Step 1 - Install project dependencies
5+
### Install project dependencies
66

77
```bash
88
yarn install
99
```
1010

11-
Step 2 - Create Postgresql database with Docker command
11+
### Run project prestart
12+
13+
```bash
14+
yarn prestart
15+
```
16+
17+
This will check for the `.env` file and load below environment variables
18+
19+
```ts
20+
POSTGRES_DB: undefined;
21+
POSTGRES_HOST: undefined;
22+
POSTGRES_PASSWORD: undefined;
23+
POSTGRES_USER: undefined;
24+
```
25+
26+
## Database Setup
27+
28+
### Create Postgresql database with Docker command
1229

1330
```bash
1431
docker run -d \
@@ -20,49 +37,56 @@ docker run -d \
2037
postgres
2138
```
2239

23-
Step 3 - Create `Users Table` from terminal
40+
### Create `Users Table` from terminal
2441

25-
1. Get in docker container terminal
42+
#### Get in docker container terminal
2643

2744
```bash
2845
docker exec -it {container_identifier} bash
2946
```
3047

31-
2. Login to Postgres
48+
The {container_identifier} for Docker is the Container ID for the Docker instance
49+
You can get it using the below command
50+
51+
```bash
52+
docker ps
53+
```
54+
55+
#### Login to Postgres
3256

3357
```bash
3458
psql -h localhost -p 5432 -U postgres
3559
```
3660

37-
3. Go to `node-postgres-demo`
61+
#### Go to `node-postgres-demo`
3862

3963
```bash
4064
\c node-postgres-demo
4165
```
4266

43-
4. Create users table
67+
#### Create users table
4468

4569
```bash
46-
CREATE TABLE users ( \
47-
id SERIAL PRIMARY KEY, \
48-
username VARCHAR(80), \
49-
email VARCHAR(255), \
50-
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP \
70+
CREATE TABLE users (
71+
id SERIAL PRIMARY KEY,
72+
username VARCHAR(80),
73+
email VARCHAR(255),
74+
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
5175
);
5276
```
5377

54-
Step 4 - Create entry in `Users table`
78+
#### Create entry in `Users table`
5579

5680
```bash
57-
curl -H 'Content-Type: application/json' \
58-
-d '{"username": "mateo", "email": "[email protected]"}' \
59-
-X POST \
81+
curl -H 'Content-Type: application/json'
82+
-d '{"username": "mateo", "email": "[email protected]"}'
83+
-X POST
6084
http://localhost:5000/api/v1/users
6185
```
6286

63-
Step 4 - Get all users
87+
#### Get all users
6488

6589
```bash
66-
curl -H 'Content-Type: application/json' \
90+
curl -H 'Content-Type: application/json'
6791
http://localhost:5000/api/v1/users
6892
```

0 commit comments

Comments
 (0)