Giter VIP home page Giter VIP logo

fastapi-hello-world's Introduction

fastapi-hello-world

"Hello World" API docker image built using FastAPI and Python

  • Running on port 8080 default
  • Quick run using docker:
docker run -it --rm --network host raushanraja/fastapi-hello-world:latest

Configuration

Environment Variables

This application uses the following environment variables, which can be customized:

  • HOST: (Default: 0.0.0.0) - The default host address.
  • PORT: (Default: 8080) - The default port number.
  • RELOAD: (Default: True) - A boolean indicating whether reload is enabled (True or False).

Running the Application

  1. Run the Docker container with customized configuration:

    docker run -e HOST="YOUR_HOST" -e PORT="YOUR_PORT" -e RELOAD="YOUR_RELOAD_VALUE" raushanraja/fastapi-hello-world:latest 

    Replace YOUR_HOST, YOUR_PORT, and YOUR_RELOAD_VALUE with your desired values.

    • HOST: Specify the desired host address.
    • PORT: Specify the port number.
    • RELOAD: Set to True or False based on your requirements.
  2. Run using docker-comopose:

    version: '3'
    services:
      fastapi:
        image: raushanraja/fastapi-hello-world:latest
        ports:
          - "8080:8080"
        environment:
          - HOST=0.0.0.0
          - PORT=8080
          - RELOAD=False
    docker-compose up
    

API Endpoints

GET /

  • Description: Returns a "Hello World" message using the GET method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "GET"
    }

POST /

  • Description: Returns a "Hello World" message using the POST method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "POST"
    }

PUT /

  • Description: Returns a "Hello World" message using the PUT method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "PUT"
    }

DELETE /

  • Description: Returns a "Hello World" message using the DELETE method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "DELETE"
    }

PATCH /

  • Description: Returns a "Hello World" message using the PATCH method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "PATCH"
    }

OPTIONS /

  • Description: Returns a "Hello World" message using the OPTIONS method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "OPTIONS"
    }

HEAD /

  • Description: Returns a "Hello World" message using the HEAD method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "HEAD"
    }

TRACE /

  • Description: Returns a "Hello World" message using the TRACE method.
  • Endpoint: http://localhost:8080/
  • Return JSON:
    {
        "message": "Hello World",
        "method": "TRACE"
    }

fastapi-hello-world's People

Contributors

raushanraja avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.