--- title: "Configure the Advanced I/O function" url: https://docs.catalyst.zoho.com/en/tutorials/newsapp/nodejs/configure-advancedio/ description: "Build a web news application that automatically fetches news from a third-party service periodically using the Catalyst Job Scheduling Cron component, and a Job Function and Advanced I/O function coded in Node.js." last_updated: 2026-08-17T12:16:04Z service: All Services type: tutorial related_links: - name: "Advanced I/O Function" url: /en/serverless/help/functions/advanced-io - name: "Data Store" url: /en/cloud-scale/help/data-store/introduction - name: "ZCQL" url: /en/cloud-scale/help/zcql/introduction --- # Configure the Advanced I/O Function The Advanced I/O function directory (`functions/news_app_function`) contains the following files: * The `index.js` main function file * The `catalyst-config.json` configuration file * Node modules * [`package.json`](https://docs.npmjs.com/files/package.json) and [`package-lock.json`](https://docs.npmjs.com/configuring-npm/package-lock-json.html) dependency files. You will be adding code in the `index.js` file. The Advanced I/O function fetches the news item from its source table in the Data Store and forwards it to the client component as a JSON response. ### Install Express Node.js Framework Since you are coding in the Node.js platform, you will be using the [`Express Node.js`](https://expressjs.com/) framework. To import the Express package in the code, you must install the Express dependencies in your system. ```sh npm install express ``` This will install the Express module and save the dependencies. ![advanced-express](https://catalyst-docs-development.zohostratus.in/images/tutorials/cron/advanced-express.webp) Copy the Node.js code and paste it in `index.js` in `functions/news_app_function` directory of your project, and save the file. You can use any IDE to work with the application's files. > **Note**: Please go through the code in this section to make sure you fully understand it. **index.js** ```javascript 'use strict'; var express = require('express'); var app = express(); var catalyst = require('zcatalyst-sdk-node'); app.use(express.json()); //GET API that gets the news from the required table app.get('/fetchData', (req, res) => { var tablename = req.query.tablename; console.log("Table Name "+tablename); //Initializing Catalyst SDK var catalystApp = catalyst.initialize(req); //Queries the Catalyst Data Store table and gets the required news getDataFromCatalystDataStore(catalystApp, tablename).then(newsDetails => { res.send({ "content": newsDetails }) }).catch(err => { console.log(err); sendErrorResponse(res); }) }); /** * Executes the Query and fetches the news from the table * @param {*} catalystApp * @param {*} tablename */ function getDataFromCatalystDataStore(catalystApp, tablename) { return new Promise((resolve, reject) => { //Queries the Catalyst Data Store table catalystApp.zcql().executeZCQLQuery("Select title,url from " + tablename).then(queryResponse => { resolve(queryResponse); }).catch(err => { reject(err); }) }); } /** * Sends an error response * @param {*} res */ function sendErrorResponse(res) { res.status(500); res.send({ "error": "Internal server error occurred. Please try again in some time." }); } module.exports = app; ``` The Advanced I/O function is now configured. We will discuss the application's architecture after we configure the client.