--- title: "Configure the Advanced IO Function" url: https://docs.catalyst.zoho.com/en/tutorials/task-manager/nodejs/config-function/ description: "Build a React task manager app to create and manage tasks. You can perform CRUD and filter functionality on tasks." last_updated: 2026-08-17T12:16:04Z service: All Services type: tutorial related_links: - name: "Catalyst NoSQL Help Documentation" url: /en/cloud-scale/help/nosql/introduction/ - name: "NoSQL NodeJS SDK " url: /en/sdk/nodejs/v2/cloud-scale/nosql/get-component-instance/ - name: "Advanced IO Function" url: /en/serverless/help/functions/advanced-io/ - name: "Function Directory Structure" url: /en/cli/v1/project-directory-structure/functions-directory --- # Configure the Advanced IO Function Now, we will begin coding the task manager application by configuring the function component. The [function’s directory](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory), `functions/task_manager_function` contains: * 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 contains the following functionalities:
Request Method Endpoint Purpose
`POST` `/addtask` To create a new task.
`GET` `/filtertask` To filter created tasks by *UserID*, *TaskName* or *Status* fields.
`DELETE` `/deletetask` To delete tasks that are no longer required.
`POST` `/updatetask` To update the content of an existing task.
### Install Required Dependencies We will be using the [Express](https://expressjs.com/) and [Axios](https://www.npmjs.com/package/axios) framework to code the Advanced I/O function. To import the **Express** and **Axios** package in your function’s code, you must install the the required dependency in your system.
Package Name Purpose
`Express` To route HTTP requests.
`Axios` To send and handle HTTP requests
To install them in your local machine, navigate to the function’s home directory (`functions/task_manager_function`) in your terminal and execute the following command: ```sh npm install express axios --save ``` ![catalyst_tutorials_nosql_taskmanager_func_cli_pack_install](https://catalyst-docs-development.zohostratus.in/images/tutorials/task-manager/catalyst_tutorials_nosql_taskmanager_func_cli_pack_install.webp) This information will also be updated in the `package.json` file. ![catalyst_tutorials_nosql_taskmanager_packagejson](https://catalyst-docs-development.zohostratus.in/images/tutorials/task-manager/catalyst_tutorials_nosql_taskmanager_packagejson.webp) Now, let’s begin coding the Advanced I/O function. Copy the code given below and paste it in the `index.js` in the `functions/task_manager_function` directory of your project, and save the file. You can use any IDE of your choice 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 catalyst=require('zcatalyst-sdk-node'); const{NoSQLItem}=require('zcatalyst-sdk-node/lib/no-sql'); const{NoSQLReturnValue,NoSQLConditionGroupOperator}=require('zcatalyst-sdk-node/lib/no-sql/enum'); const{NoSQLMarshall,NoSQLEnum}=require('zcatalyst-sdk-node/lib/no-sql'); const{NoSQLOperator}=NoSQLEnum; var app=express(); app.use(express.json()); app.use(express.static('public')); // Add a task app.post('/addtask',async(req,res)=>{ let{userID,taskName,dueDate,priority,status}=req.body; var capp=catalyst.initialize(req); const nosql=capp.nosql(); const table=nosql.table('YOUR_TABLE_ID'); try{ await table.insertItems({ item:NoSQLItem.from({UserID:userID,DueDate:dueDate,TaskName:taskName,Priority:priority,Status:status}), return:NoSQLReturnValue.NULL }); res.send({message:"Thanks! Your task has been successfully inserted."}); }catch(error){ res.status(500).send({error:"Internal server error occurred. Please try again in some time."}); } }); // Filter task app.get('/filtertask',async(req,res)=>{ const query=req.query; const parsedData={index_data:{userID:query.userID,taskName:query.taskName,status:query.status}}; const userId=parsedData.index_data.userID; var capp=catalyst.initialize(req); const nosql=capp.nosql(); const table=nosql.table('YOUR_TABLE_ID'); try{ if(userId!=null&&parsedData.index_data.taskName===''){ if(parsedData.index_data.status==='')return res.status(400).json({error:"Oops! You forgot to select a status."}); const groupOpInsert=await table.queryTable({ key_condition:{attribute:'UserID',operator:NoSQLOperator.EQUALS,value:NoSQLMarshall.makeString(parsedData.index_data.userID)}, consistent_read:true, limit:10, forward_scan:true }); let responseData=[]; groupOpInsert.getResponseData().forEach(data=>{ responseData.push({ UserID:data.item.get("UserID"), TaskName:data.item.get("TaskName"), DueDate:data.item.get("DueDate"), Priority:data.item.get("Priority"), Status:data.item.get("Status") }); }); const filteredData=await filterByStatus(responseData,parsedData); res.status(200).send(filteredData); }else if(userId!=null&&parsedData.index_data.taskName!=null){ if(parsedData.index_data.status==='')return res.status(400).json({error:"Oops! You forgot to select a status."}); const groupOpInsert=await table.queryTable({ key_condition:{ group_operator:NoSQLConditionGroupOperator.AND, group:[ {attribute:'UserID',operator:NoSQLOperator.EQUALS,value:NoSQLMarshall.makeString(parsedData.index_data.userID)}, {attribute:'TaskName',operator:NoSQLOperator.EQUALS,value:NoSQLMarshall.makeString(parsedData.index_data.taskName)} ] }, consistent_read:true, limit:10, forward_scan:true }); let responseData=[]; groupOpInsert.getResponseData().forEach(data=>{ responseData.push({ UserID:data.item.get("UserID"), TaskName:data.item.get("TaskName"), DueDate:data.item.get("DueDate"), Priority:data.item.get("Priority"), Status:data.item.get("Status") }); }); const filteredData=await filterByStatus(responseData,parsedData); res.send(filteredData); }else return res.send("Kindly enter partiyion key user ID and sort key Taskname"); }catch(error){ res.status(500).send({error:"Internal server error occurred. Please try again in some time."}); } }); // Delete Task app.delete('/deletetask',async(req,res)=>{ const query=req.query; const parsedData={index_data:{userID:query.userID,taskName:query.taskName}}; var capp=catalyst.initialize(req); const nosql=capp.nosql(); const table=nosql.table('YOUR_TABLE_ID'); try{ await table.deleteItems({keys:NoSQLItem.from({UserID:parsedData.index_data.userID,TaskName:parsedData.index_data.taskName})}); res.status(200).json({message:"Data deleted successfully!"}); }catch(error){ res.status(500).send({error:"Internal server error occurred. Please try again in some time."}); } }); // Update Task app.post('/updatetask',async(req,res)=>{ let{UserID,TaskName,DueDate,Priority,Status}=req.body; var capp=catalyst.initialize(req); const nosql=capp.nosql(); const table=nosql.table('YOUR_TABLE_ID'); try{ await table.insertItems({ item:NoSQLItem.from({UserID:UserID,DueDate:DueDate,TaskName:TaskName,Priority:Priority,Status:Status}), return:NoSQLReturnValue.NULL }); res.send({message:"Items updated successfully!"}); }catch(error){ res.status(500).send({error:"Internal server error occurred. Please try again in some time."}); } }); async function filterByStatus(data,parseData){ return data.filter(task=>task.Status.toLowerCase()===parseData.index_data.status.toLowerCase()); } module.exports=app; ``` > **Note:** Ensure you provide your table ID in lines **16**, **34**, **93**, and **106**. The function directory is now configured. We can now proceed to configuring the client directory.