How to retrieve the SharePoint List Item using Express JS

Krishna KV
Team Leader, Aspire Systems
Published On :   05 Mar 2017
Visit Count
Today :  2    Total :   2701
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!

Express JS is a node based web server for web and mobile applications. In this article we can have look into how to retrieve the SharePoint list items via Express Js

Key Features

· It is quick and easy setup.

· It support cross platform.


The middleware is a chain of function to handle requests and response. Middleware in Express Js is used to configure routing, security, models and views.



1. Node JS

2. Visual Studio Code.

Create a folder (EJS) and open it with visual studio code. Execute “run npm init” in the integrated console of VS Code. Replace the “package.json” file with the one displayed below.


     "name": "exp",
     "version": "1.0.0",
     "main": "index.js",
     "scripts": {
         "start": "node src/express.js"
     "dependencies": {
         "express": "^4.14.1",
         "body-parser": "^1.16.1",
         "compression": "^1.6.2",
         "httpntlm": "1.7.4" ,
         "lodash": "4.17.4"

Add src file and include the doc.js and express.js


 const express = require('express');
 let router = express.Router();
 let httpntlm = require('httpntlm');
 let config = {
     url: "http://sharepointurl/_api/web/lists/getByTitle('Testing')/items?$select=Title,ID",
     username: 'user',
     password: 'password',
     domain: 'domain',
     workstation: '',
     headers: {
         "Accept": "application/json;odata=verbose",
         "content-type": "application/json;odata=verbose;"
 router.get('/', (req, res, next) => {
     let httpResponse = { "statusCode": 500, result: undefined };
         function success(error, response) {
             httpResponse.result = JSON.parse(response.body);            
 module.exports = router;


 const express = require('express');
 const bodyParser = require('body-parser');
 const compression = require('compression');
 let port = 500;
 let app = express();
 let router = express.Router();
 app.use('/api', router); // Adding router middleware to express js 
 let doc = require('./doc');
 router.use('/doc', doc);
 app.listen(port, (err, req, res, next) => {
     console.log(`server started at ${port}`);

To run the api.

npm install

npm start

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

Migratiin Tools for SharePoint