Skip to content

actionanand/nestjs_task-management

Repository files navigation

Frontend for this nestjs backend


Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Local development server link

http://localhost:3000/

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

Docker - postgreSql

  1. Run postgres in docker after installing the docker locally
docker run --name postgres-nest -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
  • How to check running containers in dockers locally
docker container ls

or

docker ps

or to see inactive containers

docker ps -a
  • How to stop the container by name
docker container stop postgres-nest
  • How to start the container after stopping it by name
docker container start postgres-nest
  • How to remove or delete the container after stopping it by name
docker container rm postgres-nest
  1. Finally you can check that the access to the postgres instance using docker exec command as indicated below:
$ docker exec -it postgres-nest bash
root@9d983793b7b3:/# psql -h localhost -U postgres
psql (13.4 (Debian 13.4-1.pgdg110+1))
Type "help" for help.
postgres=# \list
                        List of databases
   Name  |  Owner | Encoding | Collate    | Ctype      | Access P..
---------+--------+----------+------------+------------+------------
postgres |postgres| UTF8     | en_US.utf8 | en_US.utf8 |
template0|postgres| UTF8     | en_US.utf8 | en_US.utf8 |=c/postgres+    
         |        |          |            |      postgres=CTc/pos...
template1|postgres| UTF8     | en_US.utf8 |en_US.utf8. |=c/postgre +       |        |        |          |            |postgres=CTc/pos...
(3 rows)
  1. Running pgAdmin docker container
  • To download the latest stable version of the image, open a terminal and type the following:
docker pull dpage/pgadmin4:latest
  • After downloading the image, we need to run the container making sure that the container connects with the other container running postgres. In order to do so we type the following command:
docker run --name my-pgadmin -p 55550:80 -e 'PGADMIN_DEFAULT_EMAIL=anand@ar.com' -e 'PGADMIN_DEFAULT_PASSWORD=postgresmaster'-d dpage/pgadmin4
  1. Accessing pgAdmin
  • You only need to open your favourite browser and type the following url: http://localhost:55550/ so your instance of pgAdmin will show up.

  • To access, type the username and the password you established in the step one, when running the postgres container (if you followed the tutorial the user name is anand@ar.com and the password is postgresmaster).

  • Once you are on the main page, you have to create a connection with the postgres server. In order to do so, just click on Add New Server and a new dialog window will show up. There you must fill in 2 mandatory fields:

    • As indicated in the following picture, a Name to identify the connection to our PostgreSQL server must be provided. In our case we have selected nest pg. You can put anyname here.

    • The second required value is Host name/address and it is located on the form under the tab Connection. The value to input is 172.17.0.2 in our case. This value can be obtained by using the command docker inspect from the terminal (this command with the -f option provides us with the networking parameters in JSON format of the container postgres-nest).

docker inspect postgres-nest -f “{{json .NetworkSettings.Networks }}”

or

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id

the output will be as below:

{“bridge”:{“IPAMConfig”:null,”Links”:null,”Aliases”:null,”NetworkID”:”3893d72cd028eb21a8653ee56290c9aaba8822d16f1453777fb107e5e12afe70",”EndpointID”:”23fce49b0adfcb2ebf307076ae641b57c58e568704826fb1ed74aec86a27eb3f”,”Gateway”:”172.17.0.1",”IPAddress”:”172.17.0.2”,”IPPrefixLen”:16,”IPv6Gateway”:””,”GlobalIPv6Address”:””,”GlobalIPv6PrefixLen”:0,”MacAddress”:”02:42:ac:11:00:04",”DriverOpts”:null}}
  • Once filled in the field Host name/address, you just need to input postgres for the user field and postgres for the password field (if you followed till now).
  1. Changing postgres password
$ docker exec -it postgres-nest bash
root@9d983793b7b3:/# psql -h localhost -U postgres
psql (13.4 (Debian 13.4-1.pgdg110+1))
Type "help" for help.

postgres=# ALTER ROLE postgres WITH PASSWORD 'postgres';
ALTER ROLE
postgres=#

Windows - postgreSql

C:\Program Files\PostgreSQL\15\bin>psql -U postgres -p 5433
Password for user postgres:
psql (15.1)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# \list
                                                                List of databases
   Name    |  Owner   | Encoding |          Collate           |           Ctype            | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+----------------------------+----------------------------+------------+-----------------+-----------------------
 postgres  | postgres | UTF8     | English_United States.1252 | English_United States.1252 |            | libc            |
 template0 | postgres | UTF8     | English_United States.1252 | English_United States.1252 |            | libc            | =c/postgres          +
           |          |          |                            |                            |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | English_United States.1252 | English_United States.1252 |            | libc            | =c/postgres          +
           |          |          |                            |                            |            |                 | postgres=CTc/postgres
(3 rows)


postgres=#

Resources

License

Nest is MIT licensed.