Coder Social home page Coder Social logo

webapp-workshop2's Introduction

NodeJS workshop

One Day workshop on understanding the Nestjs framework and to build the basic CRUD operation with postgres database.

Prerequisite

  1. Basic knowledge of docker and docker-compose
  2. Basics of express-app
    1. Which is covered in Workshop 1 Go through this repo if you haven't completed it
  3. preferred Tools:
    1. IDE: VS Code - Download Link
      Note: Install using apt
    2. API client for REST : Insomnia - Download link

Github - respository clone

  1. Fork Workshop2 repository into your account.
  2. Clone repo into your local machine run the follwing commands
    1. Create a folder GITHUB
    $ mkdir GITHUB
    $ cd GITHUB
    
    1. Clone your repository
    $ git clone [email protected]:<your-username>/WebApp-Workshop2.git
    
    Note WebApp-Workhop2 folder is created.
    $ cd WebApp-Workshop2
    
    1. Add upstream
    $ git remote add upstream [email protected]:UniCourt/WebApp-Workshop2.git
    
    1. Create a branch called dev in your local
    $ git fetch --all
    $ git checkout -b dev upstream/main
    

NestJS - Application setup with Docker

  1. Open terminal and naviagte to /GITHUB/WebApp-Workshop2/

  2. Build the docker images

    $ docker-compose build --no-cache
    
  3. Setup Postgres

    1. Bring up the Postgres docker service
    $ docker-compose up -d service-workshop-postgres
    
    1. Import database schema
    $ docker exec -i workshop-postgres psql -h localhost -U workshop_user -d nest_app < database/master.sql
    
    1. You should get a message CREATE TABLE
    2. Verify by logging into the database
    $ docker exec -ti workshop-postgres psql -h localhost -U workshop_user -d nest_app
    
    nest_app=# \d
    
    1. Note: The command \d will list all the relations.
  4. Bring up the NestJS Application

  5. Open new tab in the terminal /GITHUB/WebApp-Workshop2/

  6. Bring up the NestJS and Postgres application using docker-compose

    $ docker-compose up -d
    
  7. Execute into NestJS container to run the server

    $ docker exec -ti workshop-nestjs /bin/sh
    
    /app # npm run start:dev
    
  8. Open http://localhost:3000 on your browser

  9. You will get a message

    Hello from NESTJS <3

  10. To close the application open new tab in the terminal /GITHUB/WebApp-Workshop2/

    $ docker-compose down
    

What will you learn by the end of this workshop?

  • By the end of this workshop you will understand Nest framework structure.
  • Controller, Module and Service in NesjJS
  • Connection to Database
  • Basic CRUD operation with NestJS

webapp-workshop2's People

Contributors

noelneethanr-uc avatar pshenoy-uc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.