Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Web API with Flash: Code fast, delivery faster
Search
Matheus Monte
October 02, 2018
40
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
More Decks by Matheus Monte
See All by Matheus Monte
I Forum carreira - FMM 2020
matheusmonte
0
80
Order the Chaos: How to organize your react code
matheusmonte
0
55
React-360 - Go beyond Final frontier
matheusmonte
0
39
Técnicas de Util Prototype
matheusmonte
1
56
Serverless - Basic Concepts
matheusmonte
0
45
PyDTN
matheusmonte
0
180
Using Angular and React in same context
matheusmonte
0
42
Async Renderer - What's next?
matheusmonte
0
53
Componentization with React
matheusmonte
0
310
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
400
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
270
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
220
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
300
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Transcript
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_