Giter VIP home page Giter VIP logo

notification's Introduction

Typescript Seed Backend

Description

This is a template repository to serve as seed for new projects developed @somosphi. This repo uses Typescript as development language, Jest as test framework and other main packages.

Obs: This project is developed based in this repo.

Installing and testing the app

$ npm install
$ npm run test

Building production version

$ npm install
$ npm run build

TSLint

$ npm install
$ npm run lint

Requirements

If you want to run locally you will need:

  • Docker
  • MySQL Docker image
  • RabbitMQ Docker image
  • Kubernetes Cluster (optional)

Execution Steps

  1. Start MySQL Docker
$ docker run --name mysql -e MYSQL_ROOT_USERNAME=my-username -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 3306:3306 -d mysql:5.7
  1. Start RabbitMQ Server Docker
$ docker run --hostname rabbitmq-host --name rabbitmq -e RABBITMQ_ERLANG_COOKIE=my-cookie -p 15672:15672 -p 5672:5672 -d rabbitmq:3.8
  1. Add a user to the RabbitMQ
$ docker run --rm -it rabbitmq:3.8 rabbitmqctl add_user my-username my-password
  1. For the user to access the RabbitMQ Management Web UI, we need to set the created user as administrator
$ docker run --rm -it rabbitmq:3.8 rabbitmqctl set_user_tags my-username administrator
  1. In the management console, we need to:
    1. Create the vHost
      1. Select the Admin tab
      2. In the top right, select the Virtual Hosts option
      3. Add the name to your virtual host -- this name will be used in the .env file in the property RABBIT_VHOST_HOME
      4. Click in Add virtual host
    2. Create the queues. This project is using 3 queues, tsseed.user.create, tsseed.user.find and tsseed.user.notify.
      1. Select the Queues tab
      2. Select the created virtual host
      3. Add the queue name in the form and select the Lazy Mode option, in the bottom of the form.
      4. Click in Add queue
    3. Create the exchanges and bind the queues. In this project is used 2 exchanges, tsseed.dx (direct) and tsseed.fx (fanout)
      1. Select the Exchanges tab
      2. At the form to create the exchange, select the created virtual host
      3. Add a name for the exchange. For direct exchanges add the .dx sufix and for the fanout exchanges add the .fx sufix
      4. Click in Add exchange
      5. Select the tsseed.dx exchange to bind the direct queues
        1. In the bind form, select To queue and add the name of the queue. For this direct exchange you need to bind the tsseed.user.create and tsseed.user.find queues
      6. Go back to the exchange list and select the tsseed.fx exchange to bind the fanout queues
        1. In the bind form, select To queue and add the name of the queue. For this fanout exchange you need to bind the tsseed.user.notify queue and add the user.create routing key
        2. Again, you need to bind the tsseed.fx exchange to the tsseed.user.notify queue and add the user.get routing key
  2. Add the environment variables to the .env file
  3. Run the MySQL migrations: npm run migrate:up
  4. Run the server in development mode: npm run dev

notification's People

Contributors

marqueswsm avatar olaviolacerda avatar

Watchers

 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.