Coder Social home page Coder Social logo

weather-rest-api's Introduction

Weather REST API Microservice

Tech stack: Golang, GIN (Framework), RapidAPI

Setup information

  • Clone this repo
  • Install all dependency by this command: go get
  • In the config folder, create a file named with development.yml and copy everything from test.yaml. Put proper information in development.yml file
  • Run the server by go run main.go

API Preview

  • http://localhost:8080/health/ (To check system health)

  • http://localhost:8080/api/v1/weather/?query=&days=&dt= Query Params:

    • query (Required): Query parameter based on which data is sent back. It could be following:
      • Latitude and Longitude (Decimal degree) e.g: q=48.8567,2.3508
      • city name e.g.: q=Paris
      • US zip e.g.: q=10001
      • UK postcode e.g: q=SW1
      • Canada postal code e.g: q=G2J
      • metar: e.g: q=metar:EGLL
      • iata: e.g: q=iata:DXB
      • auto:ip IP lookup e.g: q=auto:ip
      • IP address (IPv4 and IPv6 supported) e.g: q=100.0.0.1
    • days (Optional): Number of days of forecast required. Default value is 1
    • dt (Optional): If passing 'dt', it should be between today and next 10 day in yyyy-MM-dd format. Default value is current local date.
  • For response demo check response.json file

Run unit-tests

Use this command: go test tests/weather_test.go

Some basic installation process:

  • Init module: go mod init example/weather-rest-api
  • INstall go: go get github.com/gin-gonic/gin
  • Install GoDotEnv: go get github.com/joho/godotenv

weather-rest-api's People

Contributors

farhapartex avatar

Watchers

James Cloos 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.