weather-information-system

command module
v0.0.0-...-04f5f38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

Weather Information System

This Code uses OpenWeather API to fetch and the store weather data to a MySQL database which can be accessed by an REST API Endpoint.

REST APIs
No. API Endpoint HTTP Method Description
1. /weather POST Fetch Data from OpenWeather API
2. /weather/{cityName} GET Get Data from the MySQL DB
Steps to Run

Paste the following Commands on your terminal:

Step 1: Create a Database
mysql -u root -p
CREATE DATABASE weather-information-system;
Step 2: Import the Database Schema
mysql -u root -p weather-information-system < weather-information-system.sql
Step 3: Import the Go Modules/Dependencies
go get -v ./...
Step 4: Run the Code
go run main.go
Step 5: Access the Endpoints

You can use Postman to access the REST API Endpoints mentioned above.

(The service runs on "http://localhost:9001")

Folder Structure:
.
├── cmd
│   ├── database
│   │   └── connection.go
│   ├── models
│   │   └── models.go
│   └── pkg
│       ├── endpoints
│       │   └── endpoints.go
│       ├── handlers
│       │   └── handlers.go
│       ├── repositories
│       │   └── repositories.go
│       └── service
│           ├── cities.go
│           └── service.go
├── go.mod
├── go.sum
├── LICENSE
├── main.go
├── README.md
└── weather-information-system.sql

8 directories, 13 files

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL