In this tutorial, we learn about how to set up a simple restful API with Node.js, Express, and MongoDB.

Step 1: Install Node and NPM

Before we start, we need to have NPM and Node.js installed on our machine. We relying on NPM Node Package Manager to manage all the packages and modules for Node.js.

Run the command below to verify you have NPM and Node installed. Make sure you see the version of node and npm return on command prompt.

node -vnpm -v

Step 2: Create Node.js App

Once we have the npm installed, setting up a Node.js app can be very fast. …


Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle. It is also called “Ring Buffer”.

One of the benefits of the circular queue is that we can make use of the spaces in front of the queue. In a normal queue, once the queue becomes full, we cannot insert the next element even if there is a space in front of the queue. …


You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.

Merge all the linked-lists into one sorted linked-list and return it.

Example 1:

Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: The linked-lists are:
[
1->4->5,
1->3->4,
2->6
]
merging them into one sorted list:
1->1->2->3->4->4->5->6

Example 2:

Input: lists = []
Output: []

Example 3:

Input: lists = [[]]
Output: []

Constraints:

  • k == lists.length
  • 0 <= k <= 10^4
  • 0 <= lists[i].length <= 500
  • -10^4 <= lists[i][j] <= 10^4
  • lists[i] is sorted in ascending order.
  • The sum of lists[i].length won't exceed 10^4.

Solution:


Often we may need to create or download bulk records in our application. In this tutorial, we will learn how to import and export Excel/CSV file into database in Laravel 8.0 using MaatWebsite 3.1. Grab the base source code from previous tutorial.

Installation

Run the command below to download and install the require package.

composer require maatwebsite/excel

Add the ServiceProvider and alias in config/app.php

'providers' => [
/*
* Package Service Providers...
*/
Maatwebsite\Excel\ExcelServiceProvider::class,
]
'aliases' => [
...
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
]

Now, use the following command to publish the package configuration file.

php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider" --tag=config

This will…


Continuing from the previous post, we are going to create the frontend to allow users to create, update, and view the product details using Laravel 8 Eloquent.

In Laravel 8, frontend pages are stored in the resources/views directory. Let’s create a folder called product inside the resources/views directory. Next, Create four Blade view files as below. Since our previous tutorial was integrated with an admin template. Hence, we will create the product folder inside the admin folder.

Step 1: Index Page

Copy the code snippet below to index.blade.php as template.

@extends('layouts.master')@section('title')
PRODUCT | SGWEBFREELANCER
@endsection
@section('content') <div class="row"> <div class="col-md-12"> <div class="card"> <div…


In the previous tutorial, we have set up an admin panel with Laravel 8. In this tutorial, we’ll be learning how to create a CRUD app with Laravel 8 to create, update, and delete records from a MySQL database.

Instead of writing raw SQL queries to do CRUD, we will be using Laravel 8 Eloquent to program the CRUD and manage the persistent data. Laravel Eloquent is an Object Relational Mapper (ORM) which helps in communication with the database. Each database table will have a corresponding “Model”.

Step 1: Run artisan

Firstly, run the command below to create a Product model and controller using…


In the previous post, we have learned how to set up the Laravel v8 web application. This tutorial will show you the step by step to integrate admin template to Laravel v8 web application.

First of all, download a Bootstrap Admin Template. Unzip the template file, we will be using the assets and examples folders.

Step 1: Copy the assets folder and paste it into your Laravel web project public folder.

Step 2: Go to resources-> views create two folder layouts and admin.

Step 3: Create a file name dashboard.blade.php inside admin folder.

Step 4: Copy a html file from…


This tutorial guide you step by step to build a Laravel v8 web application.

Install Laravel

First of all, install the composer with the command below.

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

After that, verify that your workstation has installed composer by run the composer command as below.

Next, we can install Laravel using composer. Run the command below.

composer global require "laravel/installer"

Ensure you set the composer path to $PATH.

export PATH=$PATH:/Users/admin/.composer/vendor/bin

Now we can start to create a Laravel project. Run the command below.

laravel new oems

Laravel comes with its own server, to verify we have successfully…


This tutorial guide you step by step on how to set up Celery 5.0 and AWS SQS to process asynchronous tasks in Django.

Your application may serve the long-running process. Instead of blocking the response, the request should be handle in the background. To achieve this, we will be using Celery and AWS SQS. Celery is an open-source asynchronous task queue which is based on distributed message passing. Celery uses AWS SQS a message broker to communication between the Celery Worker and the application. When the job is complete, the results are sent back to the backend. …


This tutorial will guide you step by step on how to dockerize Django, NGINX and PostgreSQL using Docker compose file. We have learnt how to set up Django with NGINX web server. Now we have a problem, containers are ephemeral, nothing in a container is persisted when a container is removed or dies. This shouldn’t be the case, we need to persist our data into a database; we need to keep the logs for debugging purpose. In this tutorial, we will learn about using docker volume to keep our data persistent.

Step 1: Create PostgreSQL container

We need to add a new service to the…

SGWebfreelancer

SGWebfreelancer is a software developer with 6 years experiences.

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