jshom / hackathon-call-for-code

call for code hackathon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NodejsMicroservicewithExpressjsUHOCO

Microservice project with ExpressJS on NodeJS

Platform

Table of Contents

Summary

A microservices is an individual component of an application that follows the microservice architecture - an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice exposes a RESTful API matching a Swagger definition.

IBM Cloud Enablement

Requirements

Local Development Tools Setup (optional)

  • Install the latest NodeJS 6+ LTS version.

IBM Cloud development tools setup (optional)

  1. Install IBM Cloud Developer Tools on your machine
  2. Install the plugin with: bx plugin install dev -r bluemix

IBM Cloud DevOps setup (optional)

Create Toolchain

IBM Cloud DevOps services provides toolchains as a set of tool integrations that support development, deployment, and operations tasks inside IBM Cloud. The "Create Toolchain" button creates a DevOps toolchain and acts as a single-click deploy to IBM Cloud including provisioning all required services.

*Note you must publish your project to Github for this to work.

Configuration

The project contains IBM Cloud specific files that are used to deploy the application as part of an IBM Cloud DevOps flow. The .bluemix directory contains files used to define the IBM Cloud toolchain and pipeline for your application. The manifest.yml file specifies the name of your application in IBM Cloud, the timeout value during deployment, and which services to bind to.

Service credentials are taken from the VCAP_SERVICES environment variable if running IBM Cloud Cloud Foundry, from individual environment variables per service if running on IBM Cloud Container Service (see ./server/config/mappings.json), or from a config file if running locally, named./server/config/localdev-config.js.

Run

Using IBM Cloud development CLI

The IBM Cloud development plugin makes it easy to compile and run your application if you do not have all of the tools installed on your computer yet. Your application will be compiled with Docker containers. To compile and run your app, run:

bx dev build
bx dev run

Using your local development environment

Endpoints

Your application is running at: http://localhost:3000/ in your browser.

  • Your Swagger UI is running on: /explorer
  • Your Swagger definition is running on: /swagger/api
  • Health endpoint: /appmetrics-dash
Session Store

You may see this warning when running bx dev run:

Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.

When deploying to production, it is best practice to configure sessions to be stored in an external persistence service.

Debug

Using IBM Cloud development CLI

To build and debug your app, run:

bx dev build --debug
bx dev debug

About

call for code hackathon

License:MIT License


Languages

Language:JavaScript 99.5%Language:HTML 0.5%Language:CSS 0.0%Language:Shell 0.0%Language:Dockerfile 0.0%