This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
tutorial: using django as endpoint #526
amitu
started this conversation in
Ideas & RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Status: In Done
Previous Task Discussion
TODO Service
TODO APP
FTD PR
Tasks
end-point
support for dependency #59030 September
Key Blockers
Fetching Request Data
Fetching Data from Django
To fetch data we use the
http processor
. The key missing feature is how do know the endpoint URL? Do we mention the endpoint URL everywhere wherehttp processor
is used?Instead we should be able to write:
If in our
FPM.ftd
we have:NOTE: We will not include
endpoint
stuff in this tutorial. We will ask people to deploy django separately on heroku. We will even let them use our deployed django.Lets show some minimal django view, and the JSON that is returned.
Handling Form
A form when submitted must either return some data, error, or a redirect.
Data Handling
Data handling is rare, it is possible but we do not encourage it. We encourage redirect on success.
Show UI screenshots.
Error Handling
Django will return form error. We handle errors exactly the same way as data, django has to return the variable names and values.
Show a ftd file containing error variables:
And where the form is displayed, show these error messages if they are not null.
Redirect Handling
Django has to simply return:
And
ftd.js
takes care of redirection.TODOs
Ensure Cookies Can Be Passed To http processor
Must be opt-in.
If cookie is present it will be sent up stream. If upstream modifies the cookie, it should be sent as part of response too. Every time http processor is called, cookie from response should be stored, and sent to browser at the end of http request.
Only cookie matching
$forward-cookie$
will be sent/updated. We will also support$forward-all-cookies$
, where all cookies would be sent/updated.App
In the tutorial we will create a simple todo app. The entire logic would be in
todo.ftd
.Django will have APIs:
We will use
$forward-all-cookies$
feature for this. We will create "tracker" cookie from django, a cookie that uniquely identifies the devices. Only todos created on this device would be visible on this device.Audience
We will show the API docs of the app first. The three apis listed above. And basically emphasise that we have done it in django, but it can be node, ruby, whatever.
Then we will focus of tutorial is building ftd-django interaction.
Beta Was this translation helpful? Give feedback.
All reactions