Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Sara Savanovic Djordjevic
PROG2900
Commits
28e38cf7
Commit
28e38cf7
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
add: root path behavior
parent
60baeb18
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/main.py
+6
-17
6 additions, 17 deletions
server/main.py
with
6 additions
and
17 deletions
server/main.py
+
6
−
17
View file @
28e38cf7
...
@@ -25,9 +25,11 @@ except Exception as e:
...
@@ -25,9 +25,11 @@ except Exception as e:
# Define HTTP class
# Define HTTP class
class
IceHTTP
(
BaseHTTPRequestHandler
):
class
IceHTTP
(
BaseHTTPRequestHandler
):
def
do_GET
(
self
):
def
do_GET
(
self
):
if
self
.
path
==
'
/
'
:
self
.
send_response
(
200
)
self
.
send_response
(
200
)
self
.
send_header
(
"
Content-type
"
,
"
text/plain
"
)
self
.
send_header
(
"
Content-type
"
,
"
text/plain
"
)
self
.
end_headers
()
self
.
end_headers
()
self
.
wfile
.
write
(
b
"
Root path hit!
"
)
# Start a server on port 8443 using defined HTTP class
# Start a server on port 8443 using defined HTTP class
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
@@ -53,16 +55,3 @@ def on_termination():
...
@@ -53,16 +55,3 @@ def on_termination():
# Register the function to be called on exit
# Register the function to be called on exit
atexit
.
register
(
on_termination
)
atexit
.
register
(
on_termination
)
\ No newline at end of file
# Default path
@app.route
(
'
/
'
)
def
default
():
print
(
"
Default path hit!
"
)
return
"
Return in default path
"
# Test path
@app.route
(
'
/test
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
test
():
print
(
"
Test path hit!
"
)
return
"
Return in test path
"
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