2.0.0 • Published 5 months ago

ziapf_api_dummy v2.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Ziapf-mock-server

Why mock server?

  • Simultaneous development (Fullstack Engineers, ignore). When you have a counterpart for API, decide on contract and start development. Whilst the API is ready, the UI will also be ready.
  • Multitasking. Want to work on multiple client builds? You can have multiple mock servers running on different ports.
  • When you want to do quick UI designs, congrats, use this mock-server for quick reloads. Refreshes in no time.
  • Are you writing APIs specific to JS SDK and want to check if SDK UI is compatible to your change? You have mock SDK as well.
  • No idea what icon has what name? Mock server will help you down.
  • Is CSEZ accounts server down and you are writing UI which has got nothing to do with it? No worries. Write down the API in mock-server and continue to write your UI.

Convincing enough? Get started now.

Getting started

Prerequisites

How to setup?

  • Clone this repository's Master branch.
  • Navigate to the clone directory
  • Do npm install in the cloned directory. This will install all the required NPM packages for this mock server to run.

How to run server?

Note:- You can also start multiple servers with additional parameter "port" like forever start PATHTO/ziapf-mock-server/app.js "path" `pwd` "port" "8022"

Why forever?

forever keeps your server running in the background. You can use any other way or package to run the server in the background.

What abouts - Mock JS SDK

  • When once your server is on, go to https://localhost.csez.zohocorpin.com:8021/websdk and there you see a mock SDK.
  • Web SDK mock not only allows you to test the current build's SDK but any build's SDK. Simply give zia-chat-sdk.js URL, portal and skill namespace and Submit.
  • In your clone, you can edit few parts of mock SDK UI to test which is available in /js_sdk/ path.
  • Good news? Mock server will soon plan to support more customisation options.

What abouts - Web icons

  • When once your server is on, go to https://localhost.csez.zohocorpin.com:8021/webicons and there you see a simple page with list of icons.
  • Move your mouse over each icon to know what name has it got.
  • The icons will be served from the JS build in which your server is running currently

Important Updates

In commit 83c31ba6 (Version SDK setup)

In this commit of master branch, we have added a test environment where the SDK can be tested with new flow. This flow will be served under the URL HOME/versionsdk

Read more about SDK Version setup here. So, when the repository is cloned, navigate to js_sdk_version folder and install npm as said in How do we setup? - SDK Versioning doc. When you do so, the ziaSkillsSdk configured in package.json will be served.

How do we change it to a development setup?

  • Clone your zia-chat-sdk repository
  • Move into the repository and do bower install
  • Now, in the UI that is seen when you go to versionsdk root, start the SDK watcher if not already done.
  • Now as you edit your SDK in zia-chat-sdk, you can reload the page and check as you do always.

What abouts - Proxy server

  • Running this server will point all the API urls to a configured csez server, instead of using a mock server
  • To run the proxy server, run the following in the dist folder
forever start PATH/TO/ziapf-mock-server/proxy-server.js
  • Default variables
    • PROXY_DOMAIN - 5228-u20.tsi.zohocorpin.com:8443
    • PORT - 3000
    • DIST_FOLDER - pwd