Introduction

NodeJs is a great technology which lets you perform server side task using JavaScript. In fact, it is very easy and fast to create a web server using NodeJs. There are several frameworks available on Node package manager which makes the development even easier and faster.

But creating a server side application particularly in JavaScript might be challenging . With the projects getting bigger — it becomes difficult to manage projects : reading existing code, writing new codes, trying to not repeat same code etc.

That’s why it is very important to choose a good framework — which follows good architecture, allow you to develop faster & at the same time provides good way to write clean & maintainable code. …


Introduction

Crystal is a statically type programming language which is heavily inspired by ruby & features like -

  • Concurrency using green threads known as fiber (similar to go routine)

makes it a powerful language.

In this article - we will learn how to create a rest api in crystal language using Shivneri framework. You can download code of this article from - https://github.com/ujjwalguptaofficial/shivneri-examples/tree/master/rest

Shivneri is a MVC framework for crystal which focuses on good coding styles, modularity and performance. …


Introduction

Middleware is a technique which is heavily used in nodejs frameworks like express etc. It is based on chain of responsibility pattern means one middleware will call another.

Middleware are nothing but a function which has access to request, response and next callback. They are called in the same order as defined.

e.g -

In express middleware is defined as

var express = require('express')
var app = express()
// myLogger is middleware
var myLogger = function (req, res, next) {
console.log('LOGGED')
next()
}

app.use(myLogger);

app.listen(3000)

The above code is taken from - https://expressjs.com/en/guide/writing-middleware.html

In the above code myLogger is a method and by using app.use we tell express that to use this middleWare. …

About

Ujjwal Gupta

Creator of jsstore, sqlweb, fortjs

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