-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path2-c_route.py
36 lines (27 loc) · 845 Bytes
/
2-c_route.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python3
"""0x04. AirBnB clone - Web framework, task 2. C is fun!
"""
from flask import Flask
from os import environ
app = Flask(__name__)
environ['FLASK_ENV'] = 'development'
@app.route('/', strict_slashes=False)
def index():
"""Test method to output simple greeting on localhost port 5000,
`/` path.
"""
return 'Hello HBNB!'
@app.route('/hbnb', strict_slashes=False)
def hbnb():
"""Test method to output simple message on localhost port 5000,
`/hbnb` path.
"""
return 'HBNB'
@app.route('/c/<text>', strict_slashes=False)
def c_subpath(text):
"""Test method to output simple message on localhost port 5000,
`/c/` path, converting subpaths into message text.
"""
return ' '.join(['C', text.replace('_', ' ')])
if __name__ == '__main__':
app.run(host='0.0.0.0', port='5000')