Skip to Content
0
Jul 27, 2021 at 06:13 PM

How to call .xsjs file from .xsjs file within same server?

308 Views

Hello.

This was asked before but questions seem quite old and reference no longer valid links.

I'm trying to call and xsjs file from another xsjs but always get 500 internal server error. My first approach was to import it using $.import("PATH", "FILE.xsjs") thinking it would execute the xsjs file but no.

Also tried using the outbound API ($.net.http.Request) but it doesnt seem to recognize the host to connect to since it is the same server. Neither localhost or the SERVER NAME works.

I know I can do this with xsjslib files but I want to mock API calls internally. Anything I might be doing wrong or any other approach to try this?

Thank you!