pip install bottle
python
from bottle import Bottle
app = Bottle()
python
@app.route('/')
def index():
return "Welcome to the homepage!"
@app.route('/about')
def about():
return "This is the about page."
@app.route('/user/<name>')
def user_profile(name):
return f"Profile page of {name}."
python
if __name__ == '__main__':
app.run()
python
app.PathPrefix = '/api'
app.debug = True
app.catchall = False