spoojs

0.9.960 • Public • Published

SPOO - Build a platform

SPOO (Single Point of Object) is a JavaScript framework for creating custom platforms using OBJY.

Platform

For the official Documentation, visit spoo.io/docs

SPOO is built on OBJY.

OBJY

For running a basic platform you will need Node.js, Redis and MongoDB

Spin up a Platform

npm i spoojs objy
// 1. import spoo
const SPOO = require('spoojs');
const OBJY = require('objy');

// 2. define some "object wrappers"
OBJY.define({
  name: "user",
  pluralName: "users",
  authable: true
})

OBJY.define({
  name: "object",
  pluralName: "objects"
})

// 3. run the platform via REST
SPOO.REST({
  port:80,
  OBJY,
  metaMapper: new SPOO.metaMappers.mongoMapper().connect("mongodb://localhost") // The matamapper is for basic config
}).run()

Set up a Client (SDK)

Install via npm or script tag:

<script src="spoo.js">

or

npm i spoo-client
// 1. Initialize the client
const spoo = new SPOO_Client('mytenant');

// 2. Authenticate a user
spoo.io().auth("user", "pass", function(data, err){
  if(!err) console.log('you are in!');
})

// Add an object
spoo.io().object({
  name: "Mercedes",
  type: "car",
  properties: {
    owner : {
      type: "shortText",
      value: "Peter Griffin"
    }
  }
}).add(function(data, err)
{
  if(err) return console.error(err);
  console.log(data); // {...object...}
})

// Modify an object
spoo.io().object("objectid...").addProperty({
  color: {
    type: "shortText",
    value: "red"
  }
}).save(function(data, err)
{
  if(err) return console.error(err);
  console.log(data); // {...updated object...}
})

Authors

  • Marco Boelling - Initial work - Twitter

License

SPOO is open source and licensed under the GNU Affero General Public License. See LICENSE for more details.

Contribute

If you'd like to contribute to the source code, you are welcome to open a PR. Please make sure to read the CODE OF CONDUCT.

Further reading

  • For more information on SPOO, go to spoo.io

Package Sidebar

Install

npm i spoojs

Weekly Downloads

2

Version

0.9.960

License

MIT

Unpacked Size

84.5 kB

Total Files

11

Last publish

Collaborators

  • marcoboelling