Coder Social home page Coder Social logo

fastapi-client-server-app's Introduction

fastapi-client-server-app

Dockerized fastapi client-server application (no db yet)

Description

This service is designed to receive a request with a cadastral number, latitude and longitude. It emulates sending the request to an external server and a 45-seconds delay. Once processed, it returns the result of the request. The external server is expected to respond with either "true" or "false". Both client and server sides are deployed in the single Docker container.

Endpoints

The service provides the following endpoints:

/query/

This endpoint is used to submit a request. It accepts a POST request with the following parameters:

  • number (string/float): the cadastral number associated with the request;
  • latitude (strict float): the latitude value for the request;
  • longitude (strict float): the longitude value for the request.
POST /query/
Content-Type: application/json

{
  "number": "1234567890",
  "latitude": 40.7128,
  "longitude": -74.0060
}

/result/

This endpoint is used to send the previously processed and validated request data to the emulated server. It accepts a POST request and returns the result of the request as a JSON object. The result can be either true or false. At this moment this endpoint is being used within the service, after the conversion of the query data into the dictionary. In case of separate usage the data will not be validated.

/ping/

This endpoint is used to check if the server is running. It accepts a GET request and returns a simple "pong" response.

Example Response:

GET /ping/

"pong"

To run the project, follow these steps:

  1. Clone the project from the GitHub repository. You can use the git clone command and provide the repository URL.

  2. Navigate to the project directory using the cd command.

  3. Make sure you have Docker and Docker Compose installed on your machine. If not, follow the instructions to install Docker and Docker Compose.

Run the command docker-compose up --build to start the project. This command will build the Docker container and launch it.

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.