Giter Site home page Giter Site logo

endpoints's People

Contributors

kahnvex avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

endpoints's Issues

Factor out repitition in Create and Method classes

This will allow for easily adding methods that can be applied at three levels:

  1. The Endpoint level
  2. The Method level (all GET requests originating from an endpoint)
  3. The individual method level (a single GET request from an endpoint)

Return a data management object

Instead of returning the endpoint after a call to the server, it is better to return a manager that can permute the endpoint, based on the response and the user's needs.

var callback = function(manager) {
  manager.updateEndpoint();
  console.log(manager.getResponse())
  console.log(manager.getEndpoint());
};

var myEndpoint = Endpoints.create('/')
  .methods(['get']);

myEndpoint.get
  .send()
  .then(callback)

Decouple endpoint and method implementations

Endpoint and method objects should not have to directly access eachother's properties. Http method helper can be used to decouple the two implementations, passing the method all details it needs, instead of the whole endpoint.

This will also allow thenApply to be implemented on a method, but before method creation, so doing: Endpoint.method.thenApply would be possible, instead of the one off Endpoint.method().thenApply.

Add basic functionality

Add endpoint implementation for basic endpoint patterns such as:

Collection: list and create ['GET', 'POST']
Resource: read, update, delete ['GET', 'PUT', 'DELETE']

Add data property

Each endpoint pattern should have a data property at the same level as its methods. This attribute should be set to the value of the return object, and used, but default, as the source of data when POSTing or PUTing to the server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.