Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

...

Code Block
languagebash
titleRunning the service
linenumberstrue
# go to examples/hello_worldexample01 and start the service
cd soajs.examples/hello_worldexample01/
 
# start the soajs example environment
sudo soajs services start --env=example
 
# export necessary environment variables to create local awareness
export SOAJS_ENV=EXAMPLE
export SOAJS_SRVPORT=4021
export SOAJS_DEPLOY_MANUAL=1
export SOAJS_REGISTRY_API=127.0.0.1:21000
 
 
# start service
node .

...

In this scenario, the request is sent with all the required input. The response should be a a JSON object containing the searched for object.

Code Block
languagejsbash
titleTestGet request: Success
linenumberstrue
curl -X GET "http://127.0.0.1:4021/testGet?firstName=John&lastName=Smith" 

...

Code Block
languagejs
titleTestGet Reponse: Success
linenumberstrue
{"result": true,"data": {"firstName": "John","lastName": "Smith"}}

"testPost" API: Success

This API is exactly like testGet but uses the "post" method.

Code Block
languagejs
titleTestPost request: Sucess
linenumberstrue
curl -X POST -H "Content-type:application/json" -H "Accept:application/json" "http://127.0.0.1:40104021/testPost" -d '{"firstName":"John","lastName":"Smith","email":"john@smith.com"}'

...