USE sxapi with npm
You can use sxapi with our official sxapi NPM module
Application with default configuration
- Create your working environment
mkdir test
cd test
npm install sxapi-core
- 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'));
});
- Start your application
node app.js
- Connect to
http://localhost:8077
with your favorite navigator
Application with your own configuration
- Create your working environment
mkdir test
cd test
npm install sxapi-core
- 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'));
});
- 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>"
- Start your application
node app.js
- Connect to
http://localhost:8077
with your favorite navigator