Endpoint function structure - Deepstash

Endpoint function structure

Each endpoint needs a function to manipulate and return the data. But these functions have a standard format

  • They have as parameters `self` (being a class method inside the resource), `request` (which is the `Request` instance of the client's API call
  • They expect the returned value to be a HttpResponse. For best-practice and convenience, there is a method called `create_response` that takes care of that. All you need to pass is the request and the object that you want to be included

1

13 reads

CURATED FROM

IDEAS CURATED BY

teni

Normal person with peculiar dreams @unkl's protégé @cristianmezei's disciple

My takes after reading the Tastypie documentation, regarding how a request is handled inside an endpoint

The idea is part of this collection:

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Related collections

Similar ideas to Endpoint function structure

First Class Function

In OOP we treat data and functions separately. In FP, they are all the same. We can create an array of functions, pass a function as argument, return a function from a method.

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates