Skip to main content

How to Save Form Data in Mongodb Database using Node.js

  In this tutorial we will learn how to save data from the Form in Mongodb database using a Node.js app. We will create a simple form in html in front end and use node.js as backend server to post or save the data into mangoose database. In the previous blog post, we just learned how to submit the form data using javascript, but in this blog we will learn a little advanced concept of saving the form data into a database. To learn about how to save data from a form in Mongodb database using node.js, you need to have some basic understanding of node.js, mongoose, and html. 1. Creating a Node.js app Open the command terminal on your computer and type below commands in it. mkdir sample-app cd sample-app npm init -y   2. Install Dependencies In order to successfully run our application, we need to install some dependencies as mentioned below: Mongoose: Mongoose is a Object Data Modelling library for node.js. It helps in object mapping, creating collections, saving and retrievi

SOAP Vs REST – An Overview

Both SOAP and REST provides an efficient means of communication through exchange of data between two applications using web services. Although both are unique in their approach, they score over each other depending upon their suitability in various use cases.

What is SOAP?

SOAP (Simple Object Access Protocol) is a platform agnostic web communication protocol that uses only XML to exchange data. It adheres to strict message structure of Envelop, Header, Body and Fault (error) that enhances security and uses http to communicate between different applications.

What is REST?

REST (Representational State Transfer) is an architectural style to exchange data through efficient utilization of resources accessed using a unique URI. REST rides on HTTP/HTTPS to exchange data and supports XML, HTML, plain text and JSON data for API requests and responses.

SOAP Vs REST – Which One to Select

Both SOAP and REST have their own architectural styles that are flexible, scalable, and fulfil varying project requirements leveraging various capabilities offered by them. The following factors can help in selecting a particular approach:

Resource Intensive

SOAP API is resource intensive due to the heavy XML based message structure payload that consumes large bandwidth. The XML format also makes SOAP protocol slow in processing. On the other hand, REST uses a simple architectural style to transmit data over HTTP making it lightweight and consumes less bandwidth. REST supports various data formats like HTTP, JSON, etc which are easy and faster to parse.

Security

SOAP employs advanced secured protocols like WS-Security that ensures high-level of encryption and security for the transactions/data upholding data integrity, privacy and security. REST API also uses advanced secured protocols like Https along with secured socket layer (SSL) for data security and integrity.

Transfer Protocol Support

SOAP supports various high-level and low-level transport protocols like HTTP, TCP, SMTP, FTP and more to transfer data over internet. Wide spectrum of transport protocol support helps in improving security, speed, security etc. However, REST primarily relies on HTTP/HTTPS to exchange data over internet.

Build In Error handling

SOAP has built-in successful /retrying logic that ensures that if the request fails, the client-side developer gets an XML message with error code and its explanation. This facilitates in faster error resolution and development process. REST does not provide efficient error handling capability with client side developer receiving only error code with no explanation.

Stateless and Stateful

SOAP supports both stateless and stateful operations. Primarily, SOAP is used for stateful operation that involves security and complexity. While, REST is designed for stateless operations.

Caching

REST supports caching on HTTP whereas SOAP requires additional configuration to cache information at client-side.

SOAP Vs REST – Applicability in Different Scenarios

Capabilities of REST and SOAP can be leveraged depending on scenarios and requirements.

Banking, Billing and Financial Transactions

SOAP extensively supports security protocols like WS-Security and ACID compliance enhancing transaction security and ensuring robust message encryption this is vital in financial transactions. Normally, these transactions require establishment of strict contracts between Server and Client API that can be clearly defined within a WSDL document avoiding any deviation from standard procedure.

Public API development

Since REST is a stateless operation employing GET, PUT, POST and DELETE to perform tasks, it is easier for the client API to consume it. REST is not concerned about the client side implementation of the API thus offering immense flexibility and scalability.

Extensive Interchange of Messages

REST can be efficiently used in processes where there is extensive interchange of messages such mobile or web applications. REST allows retrying logic in case of major disruption in the service.

Selecting a particular approach between SOAP and REST depends on myriad of factors like development environment, project resources, project requirements and programming language. SOAP is still suited for financial transaction due to its robust security protocols, while REST is most sought after approach for modern day web applications that requires flexibility, scalability and faster processing.

Comments

Popular posts from this blog

API Documentation Overview

 In this blog, we will explore an example of API documentation for one example function findNeedles(). findNeedles() Overview The purpose of the findNeedles() API takes two string parameters i.e. needles array and haystack and finds the total number of occurrences of each element in the needles array that are present in the haystack string. This function searches for only five words or less from the needles array and logs an error if more words are available in the needles array. The comparison is done by first splitting the haystack string using literals like backspace, tab space, single quote, and double quote etc into single elements and then looping over the needles array to find occurrences of these elements. Parameters This function takes following parameters: Name Type Description haystack String A string of any length needles String Array An array of words     Sample Code

Understanding Intents in Dialogflow

Dialogflow is a highly robust and dynamic natural language understanding platform that allows you to quickly build highly scalable conversational chatbots by leveraging the power of Artificial Intelligence (AI). You can easily create highly customizable chatbots for variety of channels like web applications, mobile applications, Facebook page, social media apps and much more. It provides seamless integration with variety of channels like Facebook, Viber, Telegram, Slack and much more. But in order to start working on building a chatbot yourself, lets connect the dots to get a clear picture of entire chatbot development process in Dialogflow. To create a chatbot, let us understand some of the nuances of the Dialogflow. What are Intents? Intents help Dialogflow ascertain the real intent or motive of the user messages. You can provide a set of certain training phrases that can help Dialogflow get trained to recognize similar such phrases and trigger a specific intent whenever such

Using Entities in Dialogflow to Extract Vital Information

Having learned about Intents in our previous blog , in this blog we will shed light on another interesting topic of Entities in Dialogflow . Entities provide an efficient way to capture and extract crucial information like name, country, location and any custom information from user inputs. Entities can be mainly categorized into three types: 1.  System Entities : These are build-in entities provided by Dialogflow through which you can identify and extract most common type of data like name, country, date, email address etc. 2. Custom Entities : These are user-defined entities that are useful to extract custom data from the user inputs. For example, you can define a Fruit entity type that can identify and map different fruit types like Mango, Apple etc.        3.  Session Entities : As the name suggests, these entities remain active only for the session for which they have been created. They provide additional capability through which we can update custom entity types with new