Bottle Web App with Greeting Route

  • Share this:

Code introduction


This code defines a simple web application using the Bottle framework. It creates a route that returns a greeting message when accessing the /greet/ path.


Technology Stack : Bottle

Code Type : Web application

Code Difficulty : Intermediate


                
                    
from bottle import route, run, request, response

def xxx():
    @route('/greet/<name>')
    def greet(name):
        response.content_type = 'text/plain'
        return f"Hello, {name}!"

if __name__ == '__main__':
    run(host='0.0.0.0', port=8080)                
              
Tags: