Image for post
Image for post

Summary

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.

Table of Contents

Introduction

Node.JS is a platform used for building server side applications using Javascript. With Node.JS, developers are able to build backend APIs in minutes. It has a great community and a huge set of packages. These packages help the developers for building great applications. Developers does not require to build everything from scratch. We mainly focus on two packages. First is Express.JS, which is one of the most used packages by developers to build web APIs. Second is mongoose, which is used to simplify the communication between Node.JS …


Image for post
Image for post

Summary

In this post, I will try to explain React — Integration with third-party libraries.

Introduction

React.js open-source javascript library for building front-end applications. According to [StackOverflow 2020 survey], it is the second most popular web framework after JQuery and the most wanted web framework in the industry.

There are many libraries that are written in plain Javascript or as a JQuery plugin, an example is Datatable.js. There is no need to reinvent the wheel, consume a lot of time and energy, and re-create those 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. …


Image for post
Image for post
Express.js — JWT Authentication

In this post, I will show you how to integrate JWT authentication into Express.js applications using jsonwebtoken.

Introduction

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. …


Image for post
Image for post
Uploading Images Using Multer

Table of Contents

Introduction

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

Image for post
Image for post

Introduction

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.

Before Start

About

Bewar Salah

Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store