Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sxapi-core

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sxapi-core

sxapi-core is an simple and extensible framework for building microservices API using javascript technologies

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

sxapi

sxapi-core project sxapi

sxapi for simple and extensible api (Application Programming Interface) is an an open-source framework for quickly building simple and small API based on microservice architecture.

Very light (application less than 100Ko, full container stack for less than 30Mo) and configured with a single json file, you can build instantly small atomic API endpoints as well as fully featured enterprise-sized API.

Build Status npm version npm dependencies last commit licence

Getting Started with npm module

The npm module method using the sxapi-core npm module published in npm public registry is the best solution if you plan to develop your own component or embed you api into another application.

For more information on how to run your first sxapi application using sxapi npm module, please read the npm module user guide

Getting Started (others methods)

The simplest and fastest way to get a running sxapi application is to use the public docker image. Read the docker image user guide

If you plan to extend sxapi-core, please read the source code user guide

Getting started with npm

1. Install nodejs and npm

Theses command are for a Red Hat Linux like environement (Fedora, CentOS, RHEL, Suse). Please adapt yum command to the apt-get equivalent if you are using a Debian like system (Ubuntu, Debian)

sudo yum install -y nodejs npm

For more information on how to install and execute a nodejs environment, please see the official npm install guide

2. Create your working directory

To run you test in a sandbox, you should isolate your sxapi test from your current work by creating a working directory.

mkdir ~/test-sxapi
cd ~/test-sxapi

3. Create your package.json

Use npm command to create your package.json file and add sxapi npm module as a dependency. For more information on how to create a npm package, you can read the npm init documentation

npm init --force
// answer dynamic questions or type multiple time <enter>
npm install sxapi-core --save

4. Create your sxapi.yml configuration file

Create a file named sxapi.yml

vi ~/test-sxapi/sxapi.yml

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 sample API</h1></body></html>"

You can change name, description, version and server.endpoints.body with personalized content

5. Create an application entrypoint

In order to start your application and execute your api, you need to create a server application file. Default file is index.js when creating package.json.

vi index.js

in you index.js, add the following lines

/* global require, process, $log, $timer */
var $app = require("sxapi-core").app;
$app.launch(function () {
    $log.info("application started");
});

6. Run your application

node index.js

7 Explore your api

Connect to http://localhost:8080/ with your favorite navigator. You should see an html message "My Sample API".

Creating your own API

sxapi-core come with many components to help you build your own api. As soon as you have an api instance working, you should focus on making change to your sxapi.yml config file and implement api endpoints you want to create. To help you understand how you can configure your api, you can :

  1. Visit sxapi-core official documentation and read carefully the configure section
  2. Visit sxapi-sample project and explore sample config file to help find sample code or ready-to-use config file

Documentation

If you want to have more information on how to install, develop and run this framework and use it in your project, please read the full documentation or our user guides and execute the following steps :

  1. Install sxapi framework
  2. Configure you API
  3. Run you application
  4. Develop sxapi resource
  5. Contribute to sxapi project

Troubleshooting

If you run into difficulties installing or running sxapi, you can create an issue.

Built With

Contributing

Read the contributing guide for details on our code of conduct, and the process for submitting pull requests to us.

Authors

This project is mainly developped by the startx dev team. You can see the complete list of contributors who participated in this project by reading CONTRIBUTORS.md.

License

This project is licensed under the GPL Version 3 - see the LICENSE.md file for details

Keywords

FAQs

Package last updated on 09 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc