USE sxapi with npm

You can use sxapi with our official sxapi NPM module

Application with default configuration

  1. Create your working environment
mkdir test
cd test
npm install sxapi-core
  1. Create a file named app.js and add the following lines
var sxapi = require("sxapi-core");
sxapi.app.launch(function () {
    sxapi.app.log.info("application started", sxapi.app.timer.time('app'));
});
  1. Start your application
node app.js
  1. Connect to http://localhost:8077 with your favorite navigator

Application with your own configuration

  1. Create your working environment
mkdir test
cd test
npm install sxapi-core
  1. Create a file named app.js and add the following lines
var sxapi = require("sxapi-core");
sxapi.app.launch(function () {
    sxapi.app.log.info("application started", sxapi.app.timer.time('app'));
});
  1. Create a file named sxapi.yml and edit it with the following content
name: sample-api
description: my sample api using sxapi-core framework
version: 0.0.0
debug: true
log:
  filters:
    level: '0,1,2,3,4'
    type: debug,info,error,warn
server:
  endpoints:
  - path: "/"
    body: "<html><head></head><body><h1>My API</h1></body></html>"
  1. Start your application
node app.js
  1. Connect to http://localhost:8077 with your favorite navigator