Configure the Advanced I/O Function
Next, we will begin coding the Document Processor application by configuring the functions component.
The functions directory you initialized, functions/zia_services_function, contains:
- The index.js main function file
- The catalyst-config.json configuration file
- node_modules
- package.json and package-lock.json dependency files
In addition to this directory, we will need to add a few sub-directories and files in the functions/zia_services_function directory.
We have the tutorial’s code in this git repository. Download it as a ZIP file and extract its contents.
Replace the index.js file in your project’s functions/zia_services_function directory with the one in the extracted zip.
The functions/zia_services_function directory from the downloaded ZIP will contain the sub-directories and files mentioned below, in addition to the default function files and dependencies.
- constants.js file
- services directory
- pojos directory
- handlers directory
- errors directory
Extract these files and add them to your project’s function’s directory. You can use any IDE of your choice to work with the application’s files.
Install Express and Multer Frameworks for Node.js
The Node.js function requires two frameworks to be installed for this application. You must install these frameworks to import their packages in your code.
express
This framework is used to enable communication between the client and server end via HTTP requests. To install Express.js, navigate to the Node function’s directory (functions/zia_services_function) in your terminal and execute the following command:
This will install the Express module and save the dependencies.
multer
Multer is middleware used to handle file upload operations from the client end. To install multer.js, navigate to the Node function’s directory (functions/zia_services_function) in your terminal and execute the following command:
This will install the Multer module and save the dependencies.
This information will also be updated in the package.json file.
The function directory is now configured. We can now proceed to configuring the client directory.
Last Updated 2023-12-15 18:54:08 +0530 +0530