Run and Test the Application

Congratulations! you are now ready to run and test your application.

Running the Application

  1. npm start

You will see the following output:

  1. Server is running at http://127.0.0.1:3000
  2. Try http://127.0.0.1:3000/ping

Test the Application

You can use your browser or any http client such as curl.

Warning: Make sure you are connected to the internet, since the SOAP webservice is external.

  1. curl http://localhost:3000/add/50/50

You will see the two properties in the response payload. The result property inJSON format and the envelope property in XML format.

The XML response is useful if you want to process the response in this format.However, if you are programming only in JSON format, focus only on the resultproperty. Your client application will have access to result value using thenormal convention result.value and get the 100.

  1. {"result":{"value":100},"envelope":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"http://wsdl.example.org/\"><SOAP-ENV:Body><ns1:AddResponse><AddResult>100</AddResult></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Changing the listening URL and PORT number

Sometimes you want to restrict the IP address to which your application will bebind and its port number. You can use Object.assign in the src/application.tsconstructor before the super(options); statement as follows:

  1. options = Object.assign(
  2. {},
  3. {
  4. rest: {
  5. url: '127.0.0.1',
  6. port: 3000,
  7. },
  8. },
  9. options,
  10. );

Navigation

Previous step: Add a Controller