SAP Business One Service Layer Proxy
MIT License
This reverse proxy can be installed in front of the SAP Business One Service Layer to improve it's performance for multiple requests when called from the SAP Cloud Platform via the SAP Cloud connector. Unfortunately the initial request to the Service Layer is very slow using basic authentication. The next requests are faster when you use the session cookie. But for requests coming from the SAP Cloud Applicaiton Programming Model the cookies are not persisted. This proxy adds the functionality to cache the cookies. As the cookies are only valid for 30 minutes also a this timeout must be checked.
The configuration is done via the following environment variables:
To setup the environment variables quickly the dotenv module is included in the project. So you can create a .env file in the root folder of this project and add the following content:
TARGET_URL=<FullURLtoYourServiceLayer or http://127.0.0.1:4004 if you set START_TESTSERVER=true>
PORT=5050
TIMEOUT=1500
START_TESTSERVER=true
LOG_LEVEL=debug
LOG_AS_TEXT=true
To run the project on your local computer you have to install the required dependencies with
npm i
Then you can start it with:
npm start
If you want to run the REST Client test in test/request.http you have to create a .env file in the test folder with the following content:
USERNAME={"UserName":"<YourUser>","CompanyDB":"<YourCompanyDB>"}
PASSWORD=<YourPassword>
SERVICE_LAYER=http://localhost:5050
please adjust YourUser, YourCompanyDB and YourPassword with your credentials for the SAP Business One Service Layer.