Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Web API with Flash: Code fast, delivery faster
Search
Matheus Monte
October 02, 2018
52
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Web API with Flash: Code fast, delivery faster
Matheus Monte
October 02, 2018
Transcript
18 slides
Web API with Flash: Code fast, delivery faster Matheus Monte
- https://github.com/matheusmonte
Who Am I? github.com/matheusmonte @montematheus_ Matheus Monte matheusmonte.github.io
REST Client-Server Stateless Layered System Uniform Interface Code on demand
None
None
None
How react Works
None
What is Flask ? "Flask is a microframework for Python
based on Werkzeug, Jinja 2 and good intentions. And before you ask: It's BSD licensed! " - Flask Web Site
Starting a new project $ mkdir todo-api $ cd todo-api
$ virtualenv flask New python executable in flask/bin/python Installing setuptools............................done. Installing pip...................done. $ flask/bin/pip install flask
Create a entry point file #!flask/bin/python from flask import Flask
app = Flask(__name__) @app.route('/') def index(): return "Hello, World!" if __name__ == '__main__': app.run(debug=True)
Starting the application $ chmod a+x app.py $ ./app.py *
Running on http://127.0.0.1:5000/ * Restarting with reloader
None
And Where is the Rest API? @app.route('/todo/api/v1.0/tasks', methods=['GET']) def get_tasks():
return jsonify({'tasks': tasks}) if __name__ == '__main__': app.run(debug=True) @app.route('/todo/api/v1.0/tasks/<int:task_id>',methods=['GET']) def get_task(task_id): task = [task for task in tasks if task['id'] == task_id] if len(task) == 0: abort(404) return jsonify({'task': task[0]}) GETS
@app.route('/todo/api/v1.0/tasks/<int:task_id>', methods=['DELETE/POST/PUT']) def delete_task(task_id): task = [task for task in
tasks if task['id'] == task_id] if len(task) == 0: abort(404) tasks.remove(task[0]) return jsonify({'result': True})
if not request.json or not 'title' in request.json: abort(400) task
= { 'id': tasks[-1]['id'] + 1, 'title': request.json['title'], 'description': request.json.get('description', ""), 'done': False }
Let's code
Thanks github.com/matheusmonte @montematheus_
More Decks by Matheus Monte
See All by Matheus Monte
I Forum carreira - FMM 2020
matheusmonte
0
86
Order the Chaos: How to organize your react code
matheusmonte
0
67
React-360 - Go beyond Final frontier
matheusmonte
0
52
Técnicas de Util Prototype
matheusmonte
1
66
Serverless - Basic Concepts
matheusmonte
0
58
PyDTN
matheusmonte
0
200
Using Angular and React in same context
matheusmonte
0
50
Async Renderer - What's next?
matheusmonte
0
65
Componentization with React
matheusmonte
0
320
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
Thoughts on Productivity
jonyablonski
76
5.5k
Color Theory Basics | Prateek | Gurzu
gurzu
1
530
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
490
A designer walks into a library…
pauljervisheath
211
25k
Making Projects Easy
brettharned
120
6.9k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
We Have a Design System, Now What?
morganepeng
55
8.4k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
410