Skip to content

๐ŸŒŠ - Surf Forecast is a Rest API for suggesting beaches to surfers based on the weather forecast on nearby beaches.

License

Notifications You must be signed in to change notification settings

hugosrc/surf-forecast-api

Repository files navigation

Surf Forecast API

Rest API that provides weather forecast on beaches for surfing.

View Demo ยป Explore the docs ยป Contribute

Table of contents

Overview

Developed based on the From Zero to Production course.

Objective

This project was created with the objective of developing something using modern concepts and techniques in software development, such as containerization, use of workflows for process automation, documentation using OpenAPI specification, and much more.

Tecnology

Data Flow

For more information, visit the API documentation.

Server

1. Create Beach

beach-flow

Example

POST /beaches

{
  "name": "Maresias Beach",
  "position": "S",
  "lat": -23.791711,
  "lng": -45.567022
}

201 Created

{
  "name": "Maresias Beach",
  "position": "S",
  "lat": -23.791711,
  "lng": -45.567022,
  "user": "61eee0f84a749ca7b4805388",
  "id": "61eee0fe4a749ca7b4805389"
}

2. Get Beach Forecast

forecast-flow

Example

GET /forecast

200 Ok

[
  {
    "time": "2022-02-04T00:00:00+00:00",
    "forecast": [
      {
        "lat": -23.791711,
        "lng": -45.567022,
        "name": "Maresias Beach",
        "position": "S",
        "rating": 2,
        "time": "2022-02-04T00:00:00+00:00",
        "swellDirection": 186.06,
        "swellHeight": 0.61,
        "swellPeriod": 9.05,
        "waveDirection": 182.25,
        "waveHeight": 1.17,
        "windSpeed": 7.12,
        "windDirection": 67.68
      },
      ...
    ]
  },
  ...
]

Developing

To develop for this project it is recommended that you have Docker and Docker Compose installed.

First steps

  1. Clone the repository:
$ git clone https://github.com/hugosrc/surf-forecast-api
  1. Build the base images:
$ docker-compose build surfforecast-api

Running the server

  1. Start database
$ make start-db
  1. Then finally, start the server
$ make surfforecast-api

Testing

# Run all tests 
$ yarn test

# Run all unit tests
$ yarn test:unit

# Run all functional tests
$ yarn test:functional

Contact

Linkedin Badge

Gmail Badge

About

๐ŸŒŠ - Surf Forecast is a Rest API for suggesting beaches to surfers based on the weather forecast on nearby beaches.

Topics

Resources

License

Stars

Watchers

Forks