Skip to content

REST service for Kinann neural network stepper motion control

License

Notifications You must be signed in to change notification settings

firepick/kinann-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RestBundle

Simplify REST API creation and maintentance with re-usable REST bundles. Encapsulate related REST services in a single JavaScript class that extends RestBundle.

Example: Define a REST bundle comprising a single resource (i.e., /greeting/hello) with handlers for GET and POST:

class HelloRest extends RestBundle {
    constructor(name="greeting",options = {}) {
        super(name, options);
        var handlers = [
            this.resourceMethod("get", "hello", this.getHello, "text/html"),
            this.resourceMethod("post", "hello", this.onDie),
        ];
        Object.defineProperty(this, "handlers", {
            value: handlers,
        });
    }

    getHello(req, res) { return "hello"; }

    postHello(req, res) { throw new Error("goodbye"); }
}

Add HelloRest to a nodejs application:

const HelloRest = require("../test/hello-rest");
var helloRest = new HelloRest("greeting");
helloRest.bindExpress(app);

Launch web server:

npm start

A RestBundle can be shared for use by others as an npm package.

Vue 2

RestBundle relies on Vue.js for modular web components.

  1. npm run dev
  2. http://localhost:4000/greeting/ui

About

REST service for Kinann neural network stepper motion control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published