New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

api-core

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-core

Core classes for building dynamic model based multi-level APIs for any provider.

  • 0.0.7-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62
decreased by-55.71%
Maintainers
1
Weekly downloads
 
Created
Source

api-core

Core classes for building dynamic model based multi-level APIs for any provider (Express, socket.io, etc.).

UNDER CONSTRUCTION First beta and documentation coming soon...

SNEAK PEAK Working Demo: api-demo on GitHub

const Express = require('express'),
      app = new Express;

const studentEdge = new StudentEdge,
      classEdge = new ClassEdge,
      courseEdge = new CourseEdge,
      courseTypeEdge = new CourseTypeEdge,
      schoolEdge = new SchoolEdge;

const api
    = new Api('1.0')
        .edge(studentEdge)
        .edge(classEdge)
        .edge(courseEdge)
        .edge(courseTypeEdge)
        .edge(schoolEdge)
        .relation(new OneToOneRelation(courseEdge, courseTypeEdge))
        .relation(new OneToManyRelation(courseTypeEdge, courseEdge))
        .relation(new OneToManyRelation(studentEdge, courseEdge))
        .relation(new OneToOneRelation(studentEdge, classEdge))
        .relation(new OneToOneRelation(classEdge, schoolEdge))
        .relation(new OneToOneRelation(courseEdge, classEdge))
        .relation(new OneToManyRelation(classEdge, studentEdge))
        .relation(new OneToManyRelation(classEdge, courseEdge))
        .relation(new OneToManyRelation(schoolEdge, studentEdge))
        .relation(new OneToManyRelation(schoolEdge, classEdge));

app.use(require('body-parser').json());

const router = new ExpressApiRouter(api);
router.apply(app);

app.listen(8080);

//TEST: http://localhost:8080/api/v1.0/schools/s1/students/s2/class/courses?fields=id,name

//RETURNS:
// [
//     {
//         "id": "c1",
//         "name": "Maths A1"
//     },
//     {
//         "id": "c6",
//         "name": "Science A1"
//     }
// ]

FAQs

Package last updated on 27 Oct 2016

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