Creating a simple node project

Creating a simple node project:

Recently one of my client had a requirement like standalone application which consumes rabbitmq messages from a unique exchange with type topic. This application need to perform some validations on received message and make HTTP call to another server and forwards the updated data.
As per my client requirement I have developed standalone java application but I just wanna try the same using nodejs (I am java & javascript developer from the very beginning). In my office we used to follow standard node+express development kit for most of the application. All the application I have worked are developed on top of that development kit with express.
This time I want to write my own node application without express to fulfil above requirement.

I have `npm` already installed in my laptop, So I have used `npm` to generate my initial project.
npm init
This process asks questions and generates package.json, Here steps will be like,
[package name: (rabbitmq-javascript-client) `rabbitmq-javascript-client`
[version: (1.0.0) `1.0.0`
[description: `Sample RabbitMQ Javascript client`
[entry point: (index.js) 
[test command: 
[git repository: (https://github.com/hmudimi/rabbitmq-javascript-client.git) 
[keywords: 
[author: `Hemakumar`
[license: (ISC) 
About to write to /Users/hmudimi/rabbitmq-javascript-client/package.json:
{
  "name": "rabbitmq-javascript-client",
  "version": "1.0.0",
  "description": "Sample RabbitMQ Javascript client",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/hmudimi/rabbitmq-javascript-client.git"
  },
  "author": "Hemakumar",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/hmudimi/rabbitmq-javascript-client/issues"
  },
  "homepage": "https://github.com/hmudimi/rabbitmq-javascript-client#readme"
}
[Is this ok? (yes) `yes`
We can use `npm init -y` to generate package.json file with default values.

I wanna include MIT license to my application so I have `npx license mit` to generate mit license. Here license will package will be help to download license of your own choice. To generate license file in local system use command,
npx license mit > LICENSE
o/p:    npx: installed 5 in 5.348s

Next step will be generate gitignore file, I have used following command to generate .gitignore file,
npx gitignore node
o/p:    npx: installed 1 in 4.859s
        Created .gitignore file for type Node :)

You can use `npx covgen`, which provides a code of conduct that will be welcoming to all contributors. But as a sample I don't wanna use it for now.

Now our node project structure is ready, Next thing is creating index.js and start developing code.

In next step, we will discuss the development of rabbitmq-javascript-client.

Comments

Popular posts from this blog

conditional subschemas (writing conditions inside a JSON Schema)

JSON Schema validation keywords with more explanation

nodejs/javascript client for Rabbitmq