DEMO: Node.js
This chapter introduces how to call the Ultra Encode APIs in Node.js.
Download DEMO: ultra-encode-api-demo-nodejs.zip
DEMO Structure
ultra-encode-api-demo-nodejs
|
|-- httpUtils.js // encapsulates the get and upload method based on the HTTP module of Node.js.
|-- xxxx.mwf // file uploaded by upload.js through invoking the upload-update-file interface.
|-- get.js // requests data using GET
|-- upload.js // uploads file using POST
Requirements
- Operating System: macOS, Linux, or Windows
- Node.js Runtime: LTS releases (8.x and later)
Running Mode
- Navigate into the DEMO directory in the terminal.
cd ultra-encode-demo-nodejs
- Replace deviceIP with the IP address of the test device in get.js and upload.js.
- Run get.js.
node get
- Run upload.js.
node upload