Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

firepick/kinann-rest

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

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors