This server application is developed using Node-JS and integrates with Google Sheets as target application. This adheres to ECF API spec as defined here
- Node.js: Download and install Node.js from the official website: nodejs.org
- Enable the Google Sheets API by following this and download the JSON key file (credentials.json).
- Create a google sheet (Refer sample sheet used while developing this sample application), which will be treated as your target application.
- Install Visual Studio or any other preferred Node JS IDE.
- Clone this repository and import this project to Visual Studio.
- Copy the downloaded credentials.json to {Base Folder}/utils folder.
- Update below line in {Base Folder}/utils/googlesheets.js file to refer the credentials.json. const credentials = require('../utils/external-connector-framework-09842e2d8788.json');
- Sample code refers sample sheet, since you have created a new sheet, please update spreadsheet ID, sheet names and data ranges in respective {Base Folder}/service/{File based on operation}.
- Install Required Packages: "npm install googleapis fs readline"
- Go to Developer Tools in visual studio and run:
npm start
- You should get a success message as "Your server is listening on port 8080".
- Access the swagger UI interface by accessing below URL in your web browser:
http://localhost:8080/docs
- Since this is fully functional Node-JS server code which integrates Googles Sheets, you should be able to try out various operations using Swagger UI.
- For import operations validate the response returned from API.
- For provisioning operations validate the updates made to Google Sheet.
This is just a sample code to give you head start in your ECF coding jorney. If you are reusing this code or writing a new project. please ensure to incorporate best coding practices.
- Write code which is optimized for better performance.
- Use detailed loggers.
- Don't read/write passwords in plain text (sample code is writing sample password values in plain text in sheet).
- Add custom logic for request body validation.
- Implement error handling.
Happy Coding !!!