Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

github.com/felipecurvelo/weather-reporting-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/felipecurvelo/weather-reporting-api


Version published
Created
Source

weather-reporting-api

API building exercise

Install Go

Before running the api please make sure you have Go installed. https://golang.org/doc/install

Clone the repo

You can clone the repo using git clone or go get.

Buiding, Testing and Running

Use makefile commands to get things working:

CommandDescription
make buildBuild the API
make testRun all automated tests
make runRun the API

API Endpoints Examples

Auth

Request:

POST http://localhost:8080/auth/
{
	"name": "kirang",
	"password": "secret"
}

Success Response:

{
    "token": "3ac9f318f426aef056f46a9e02b69d08b8a92646"
}

Save

Request:

POST http://localhost:8080/weather/
"Authorization": "3ac9f318f426aef056f46a9e02b69d08b8a92646"
{
	"city": "vancouver",
	"weather": [{
		"date": "2020-04-17",
		"temperature": 17
	},
	{
		"date": "2020-04-18",
		"temperature": 18
	},
	{
		"date": "2020-05-18",
		"temperature": 16
	}]
}

Success Response:

{
    "message": "The weather was saved succesfully!"
}

Get

Request:

GET http://localhost:8080/weather/
"Authorization": "3ac9f318f426aef056f46a9e02b69d08b8a92646"
{
	"city": "vancouver",
	"initial_date": "2020-04-01",
	"end_date": "2020-04-30"
}

Success Response:

{
    "city": "vancouver",
    "weather": [
        {
            "date": "2020-04-17",
            "temperature": 17
        },
        {
            "date": "2020-04-18",
            "temperature": 18
        }
    ]
}

Delete

Request:

DELETE http://localhost:8080/weather/
"Authorization": "3ac9f318f426aef056f46a9e02b69d08b8a92646"
{
	"city": "vancouver"
}

Success Response:

{
    "message": "The weather was deleted succesfully!"
}

FAQs

Package last updated on 18 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc