ngrok
ngrok copied to clipboard
Improvements for getApi()
Solution for #252
Changes
index.js
- getApi()
- Check if
ngrokClient
is defined, return if so. Else, CallgetProcessUrl
to get the process URL for port 4040, and create a new instance ofNgrokClient
. Fallback to null.
src/process.js
- Include
getProcessUrl
which spawns a child process and makes the platform appropriate query for port 4040's process URL.
ngrok.d.ts
- Update
getApi()
type definition to return a nullable promise.
test/ngrok.guest.spec.js
- Update
"getting internal api wrapper"
test case to callgetApi()
with async/await. - Include additional assertion
"should be an instance of NgrokClient"
.
Tests run successfully on Mac, Windows 10, and Linux. Open to any improvements!