In this post, I will show you how to build a blog web API in Node.JS. This tutorial uses Express.JS for handling HTTP requests and Mongodb for storing data.
In this post, I will try to explain React — Integration with third-party libraries.
When I started working on React.js last year, I faced a big problem. Integrating React.js with other libraries is not easy and straight-forward. …
In this post, I will show you how to integrate JWT authentication into Express.js applications using jsonwebtoken.
We need to secure user’s data from being changed or displayed without permission. There are many types of authentications. We usually secure web APIs using JWT authentication. This method suits best for web APIs. It does not require to store cookies on client or sessions on the server. It is a stateless way of authorizing resources. It is super easy to implement. It is very popular method for authenticating web APIs among the others.
There are many articles written about this topic. I will try to minimize the topic and show the best practices with some security concerns like hashing passwords. Jsonwebtoken is an NPM package that can generate JWT tokens and verify them. We also use bcrypt package to hash the passwords before saving it in DB. It protects the password from being displayed by DB administrators. …
Today, we can find many apps and websites that upload images like photo sharing apps or blog websites. That is why, there are many good reasons to allow users store files on server. Http servers handle file uploading using POST requests. The case is different while talking about node.js. It is hard for node.js alone without using a library to handle uploading. That is the reason, there are many npm packages available. Multer is a good uploading npm package. It is mainly used with express.js.
Building web APIs is easy with Express.JS. I have already posted a tutorial about express.js. Multer is a npm package that handles multipart/form-data. It enables express.js applications to accept files. It is very easy to configure in express.js servers. This blog is minimized to teach only file uploading using multer, however it tries to give you a clue on how to link an image to a record in database and retrieve it later. …
“Test-driven development (TDD) is a way of managing fear during programming” — Kent Beck
TDD which stands for test driven development is a way of building software applications. This approach adds extra complexity to the process. Developer has to write extra code — test cases. TDD makes sure that the piece of code is doing the required task before releasing. It makes sure the code can be changed easily as business requirement tends to change. The process consists of three main steps: Writing failing tests, writing code that satisfies tests and refactoring.