Code Monkey home page Code Monkey logo

shadow-talk-microservices's Introduction

Shadow Talk Microservices

Shadow Talk Microservices were built using the following technologies:

Description

This repository contains the source code of the microservices that make up the Shadow Talk application. The microservices are:

  • create-session-service: Service for creating a new anonymous session.
  • get-session-service: Service for getting an anonymous session information.
  • create-post-service: Service for creating a new post.
  • get-posts-service: Service for getting posts.

Additionally, the repository contains a sample service (sample-service-template) that can be used as a template for creating new microservices, as well as the source code of the API Gateway that is used to communicate with the microservices from the client.

Microservices structure

Each microservice is a Node.js application that uses the Express framework. The microservices are structured as follows:

  • src - Contains the source code of the microservice.
    • app.js - The entry point of the microservice with the Express application and routes.
    • models.js - Contains the models of the microservice (used for database operations).
    • schemas.js - Contains the schemas of the microservice (used for validation).
    • settings.js - Contains the settings of the microservice (used for configuration).

Installation

Go to each microservice directory and run the following command:

npm install

Environment Variables

Before starting the microservices, make sure you have configured the environment variables. For development, you can create a .env file in the root directory of each microservice and add the environment variables there (you can use the .env.example file as a template). For production, you can set the environment variables in the server's environment.*

The following environment variables are used by all microservices:

  • PORT - The port the microservice will listen on. Defaults to 3000.
  • ALLOWED_ORIGINS - A comma-separated list of allowed origins. Defaults to http://localhost:3000. Used by microservices to only allow requests from the API Gateway.
  • DATABASE_URL - The URL of the MongoDB database. Defaults to mongodb://localhost:27017/shadowtalk.

To configure the environment variables of the API Gateway, see the README file in the api-gateway project.

Usage

To start each microservice, go to the microservice directory and run the following command:

npm start

Development

To start each microservice in development mode, go to the microservice directory and run the following command:

npm run dev

Useful Resources

shadow-talk-microservices's People

Contributors

jorgeandrespadilla 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.