creating a rest api using node.js express -- w3web.net

Create Node js Rest Api to get, insert, update and delete records from SOQL Using Express JS, Install pool database, Install pg module and Install localserver for Start port terminal and project structure setup | How to insert, update, retrieve and Delete Record from Node js Rest Api Using Express JS, pool, pg module and localserver in Salesforce (SOQL)

Hey guys, today in this post we are going to learn about How to Create Node js Rest Api to get, insert, update and delete records from SOQL Using Express JS, Install pool database, Install pg and Install localserver to Start port terminal and project structure setup

Real time scenarios:-Install pg module for run localhost, install pool for connect database and install localserver to run local API URL(endpoint url) and Start for port terminal:- node index.js

In this example we are connecting Heroku database (postgres) with authentication of user, password, host, port and database

After connecting the database we are insert, update, retrieve and Delete recorda from Salesforce (SOQL) Credentials.

I am using following dependency libraries in this nodejs project:-

  • Express js : Express is a framework for building web applications on top of Node.js
  • Pool database connect:- Use to create connection with Heroku database (postgres) with authentication that allow connect into data table (SOQL).
  • body-parser:- This nodejs module help to reading data from the ‘form’ element and attached with request.
  • template.pug:- Install template pug for display API data in HTML table format.

The Node js Rest API details are as follows:-

Route Method Description
/data Get Get all scoreCard__c (Salesforce Custom Object) data from Salesforce
/update Post Update scoreCard__c (Salesforce Custom Object) record into database Salesforce
/insertdata Post Insert new coreCard__c (Salesforce Custom Object) record into database Salesforce
/deleteRecord Post Delete particular coreCard__c (Salesforce Custom Object) record from database Salesforce

Live Demo

creating a rest api using node.js express and pg module -- w3web.net

Create Node Index.js

Step 1:- Create Node Index.js

Install localserver (npm install localserver )

Step 2:- Create a file localserver.js

creating a rest api using node.js -- w3web.net

Further post that would you like to learn in lightning component.

FAQ (Frequently Asked Questions)

What is Node JS REST API?

REST stands for Representational State Transfer. REST is web standards based architecture and uses HTTP Protocol.

How do I create a secure REST API in node JS?

To make your APIs Restful, you must follow a set of constraints while writing them.

What is REST API services?

A REST API is an application programming interface that conforms to the constraints of REST architectural style and allows for interaction with Restful web services.

Related Topics | You May Also Like

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | The Sitemap where you can find all published post on w3web.net

Leave a Comment