In Part 1 to 4, we went through solidity to develop smart contract in Remix, setup development environment, created unit testing methods for smart contract, created a front-end application with Node.js to interact with smart contracts. Now, we will deploy smart contract using truffle and infura. Also, will deploy Node.js application to Heroku.
datetime-local allows user to enter both a date and a time and the user’s local time zone is used. For simplicity, Let’s enhance this to allow user to select any timezone. We are going to use Moment-Timezone library.
In my post, I explained how to test server side REST APIs in Node.js using Mocha, Sinon and Chai. I used ES6 test methods for this and Babel is used to execute it. As test methods are executed at development end, so NO need to transpile ES6 to ES5 first and then debug the converted files. You can directly debug ES6 code with Babel.
Do you want to set up an API versioning in Node.js and Express environment? This tutorial explains the different ways to do REST API versioning step by step. We will implement the following routing for the versioning:
In this post, we will implement to get all files recursively in a directory using Node.js. Also, will restrict it to traverse directory with limited recursively depth.
Before we get started, consider the following directory structure(For simplicity, the name is according to their depth level i.e. folder 1, sub folder 1.1, sub sub folder 1.1.1…etc):
1 > 1.1 > 1.1.1> 22.214.171.124 > 126.96.36.199.1 2 > 2.1 > 2.1.1 > 2.2
Each directory has txt file with same directory name(means 1.1 will have 1.1.txt file).
In my last post, I spent some hours to create a stub to skip passport.authenticate method for REST API testing. So, I decided to write a separate post on the same. Before we get started, let’s take a look on how auth middleware is implemented:
In my recent post, I covered how to implement token based authentication using Passport, JWT and bcrypt. Let’s extend this post and look into testing REST APIs or server side methods in Node.js using Mocha, Chai and Sinon.
Mocha: It is a test runner to execute our tests.
keywords in code = Describe, It, before, after…etc
Chai: It is an assertion library and allows to write code like writing regular english.
keywords in code = should, assert..etc.
Sinon: It provides test spies (fake functions to track executions), stubs (replace functions with our fake implementation) and mocks (predefined fake method with behaviour).
Do you want to setup your MEAN stack (MongoDB, Express, AngularJS and Node.js) application on Azure App Services with Continuous Integration and Delivery? Here are step by step videos to deploy a MEAN application to Azure Web Apps via GitHub and store the app’s data inside Cosmos DB (a drop-in replacement for MongoDB).
d:\>nvm install 4.7.2 d:\>nvm use 4.7.2 d:\>node --version
and if you get following message
‘node’ is not recognized as an internal or external command, operable program or batch file.
then read this post to troubleshoot the issue.