1.0.21 • Published 5 years ago

node-js-restful-api-cli v1.0.21

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Quick Start Nodejs Api Cli

Required

  • nodejs version >= 6 . x . x
  • npm version >= 3 . x . x
  • mongodb

Installation

$ npm i -g node-js-restful-api-cli --save

1. Start Project

$ node-js-restful-api-cli new [Name Project]
  • select "node-server"
  • input Project name

2. Create Module

$ node-js-restful-api-cli g

input Module name

3. Install package

$ npm install

4. Start

$ npm start

Unit Test

$ npm test
  • test connect database mongoDB
  • test module

Support

  • Docker
  • RabbitMQ
  • Microservice
  • Circleci

RabiitMQ

config file src/module/core/controller/rabbitmq.js

1. Import

mq = require('../../core/controllers/rabbitmq')

2. Publish data or message to microservice other

var data = {
    firstname:"nametest",
    lastname:"lasttest"
}

mq.publish('id', 'dataid', JSON.stringify(data))
  • "id" and "dataid" not duplicate
  • send message only string

3. consume data or message

mq.consume('id', 'name', 'dataid', (msg) => {
    console.log(msg.content.toString())
  });

Docker Run

Build the Dockerfile and tag the image as my_image :

$ docker build -t my_image .

Use the following command to run my_image inside a container:

$ docker run -d -p 3000:3000 --name my_image [namecontainer]
1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago