Giter Site home page Giter Site logo

md-redwan-hossain / bd-geographical-data-api Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 224 KB

This API is tailored to provide up-to-date geographical data for Bangladesh with proper interconnectedness.

Home Page: https://bd-geographical-data-api.onrender.com/swagger/index.html

License: MIT License

C# 98.61% Dockerfile 1.39%
api asp-net-core bangladesh csharp geographic-data sqlite

bd-geographical-data-api's Introduction

Rationale

This API will provide Division, District, Sub-District related data of Bangladesh. The database is already provided as app.db with loaded data. Data examples:

  • A Division and its Districts and Sub-Districts.
  • A Districts and its Division and Sub-Districts.
  • A Sub-District and its Division and District.

Screenshot of swagger doc

Where to use

  • Data provided by this API are frequently used in web applications where Geographical data is utilized.

Why the API is read only?

  • To enable POST or PATCH request, authentication needs to be added which will be too much opinionated.
  • The database can be manipulated directly by SQL query or via separate API backend where proper authentication strategy is being used according to the business demand.

How to run

  • The preferred way to use the API is docker. However, you need dotnet 8 to run the source code.
  • Precompiled binaries are also available in the release page. Just extract them and use.
  • For API documentation, go to /swagger endpoint. Example url: http://localhost:5000/swagger
  • If any package is missing, simply run:
dotnet restore

Docker

  • Docker file is added in the repo.
  • Port 8080 is the exposed port for docker.
  • For example, for Swagger documentation: http://localhost:8080/swagger

Environment variable

  • Data can be loaded inside the application in Environment variable fashion through:

    • appsetting.json for generic data.
    • appsettings.Development.json this will be loaded when ASPNETCORE_ENVIRONMENT == Development
    • appsettings.Production.json this will be loaded when ASPNETCORE_ENVIRONMENT == Production
    • secrets.json for sensitive data. It is optional only loaded when the file exists.
  • These files can accept any valid json value and they must be created in the parent directory (where Program.cs is located).

Response Cache

  • Response Cache is enabled by default. The default cache time is 600 seconds (10 min) which can be changed through RESPONSE_CACHE_DURATION_IN_SECOND
  • Note: Response Cache does not store any data in the server. It is all about how the client will cache the response so that it does not need to send the request again.

Running from compiled binary

  • If you want to run from single executable self-contained binary from the release page, port conflict may occur. To solve this issue, add the following lines in the existing json object of any of the files mentioned in Environment variable to configure the port of kestrel server.
  "Kestrel": {
    "Endpoints": {
      "HTTP": {
        "Url": "http://localhost:5169"
      }
    }
  }

bd-geographical-data-api's People

Contributors

md-redwan-hossain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.