Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tiqi-js-tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matt Grau
tiqi-js-tutorial
Commits
0edae25a
Commit
0edae25a
authored
3 years ago
by
Matt Grau
Browse files
Options
Downloads
Patches
Plain Diff
create flask app routes for device
parent
1380a68c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.py
+41
-0
41 additions, 0 deletions
server.py
server/server.py
+0
-12
0 additions, 12 deletions
server/server.py
with
41 additions
and
12 deletions
server.py
0 → 100644
+
41
−
0
View file @
0edae25a
import
flask
from
device
import
Device
device
=
Device
()
app
=
flask
.
Flask
(
__name__
)
@app.route
(
'
/
'
)
def
main
():
return
'
Hello World!
'
@app.route
(
'
/get_voltage
'
)
def
get_voltage
():
return
str
(
device
.
voltage
)
@app.route
(
'
/set_voltage/<new_voltage>
'
)
def
set_voltage
(
new_voltage
):
device
.
voltage
=
float
(
new_voltage
)
return
''
@app.route
(
'
/get_current
'
)
def
get_current
():
return
str
(
device
.
current
)
@app.route
(
'
/set_current/<new_current>
'
)
def
set_current
(
new_current
):
device
.
current
=
float
(
new_current
)
return
''
@app.route
(
'
/calculate_resistance
'
)
def
resistance
():
return
str
(
device
.
resistance
)
if
__name__
==
'
__main__
'
:
app
.
run
(
host
=
'
0.0.0.0
'
,
port
=
8000
)
This diff is collapsed.
Click to expand it.
server/server.py
deleted
100644 → 0
+
0
−
12
View file @
1380a68c
import
flask
app
=
flask
.
Flask
(
__name__
)
@app.route
(
'
/
'
)
def
main
():
return
'
Hello World!
'
if
__name__
==
'
__main__
'
:
app
.
run
(
host
=
'
0.0.0.0
'
,
port
=
8000
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment