minigatewaydev / typescript-sample

Sample TypeScript code (Console App) for accessing MiniGateway HTTP Server for sending SMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Code Sample

This sample is constructed using Visual Stuido Code 1.38.1, so the editor is required if you want to modify run the application out of the box. You may also use another IDE of your choice, but some code structure may need some modification or conversion.

Note: This sample is constructed with TypeScript v3.6.3 that depends on NodeJS v10.16.3.

Project dependency

This project uses the following library:

  • Axios → npm i axios
  • TS Stopwatch → npm i ts-stopwatch

Running sample in VSC

A TypeScript (.ts) code is transpiled into JavaScript (.js) file using VSCODE internal task runner, so it can be run using node command.

Before that:

  • Download as ZIP and extract
  • In VSC, File > Open Folder

To transpile code automatically, do this:

  • Hit ctrl + shift + B
  • Select tsc:watch - tsconfig.json

A terminal will be displayed with current TypeScript compiler watch status. This watching behavior happened in real-time.

Please ensure that the real-time compiler watch status is always happen. Otherwise, new changes in your TypeScript code will never renewed in JavaScript code.

More information: https://code.visualstudio.com/docs/typescript/typescript-compiling

After doing all above, to run the sample:

  • Make sure to change the required information in app.ts file
  • Terminal > New Terminal
  • type node app.js (.js and NOT the .ts) and hit enter

About

Sample TypeScript code (Console App) for accessing MiniGateway HTTP Server for sending SMS


Languages

Language:TypeScript 100.0%