GithubHelp home page GithubHelp logo

aysllagomes / distance-calculator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 460 KB

Distância entre dois pontos, considerando o preço do combustível, o intervalo na direção e a hora da partida.

License: MIT License

JavaScript 2.78% TypeScript 97.22%

distance-calculator's Introduction

Travel Calculation Project

This project is an API for calculating details of a trip, including travel time, fuel cost, carbon emissions, and weather conditions along the route.

Features

  • Calculate distance and travel time between two locations.
  • Calculate fuel cost for the trip.
  • Calculate carbon emissions for the trip based on fuel type.
  • Obtain weather conditions at the origin and destination points.

Technologies Used

Prerequisites

  • Node.js v14 or higher. You can download it here
  • NPM. You can install it by following the instructions here para NPM.
  • Google Maps API account and key. You can obtain a Google Maps API key by following the instructions here

API Documentation

The API documentation is automatically generated by Swagger. After starting the server, you can access the interactive documentation at http://localhost:3000/api-docs.

Installation

  1. Clone the repository:
   git clone https://github.com/AysllaGomes/distance-calculator.git
   cd seu-repositorio
  1. Install dependencies:
    npm install
  1. Configure the Google Maps API key. Create a .environment.ts file in the project config and add your API key:
    GOOGLE_MAPS_API_KEY=your_google_maps_api_key
    OPEN_WEATHER_MAP_API_KEY=your_open_weather_map_key
  1. To start the development server:
    npm run start:dev
  1. Endpoint:

Calculate Trip:

URL: /calculate-trip

Method: POST

Body:

{
     "origin": "Planaltina, Goiás, Brasil",
     "destination": "Conceição da Aparecida, Minas Gerais, Brasil",
     "fuelConsumption": 10,
     "fuelPrice": 5.80,
     "averageSpeed": 77,
     "drivingStartTime": "09:00",
     "drivingEndTime": "18:00",
     "departureDate": "2024-06-07",
     "fuelTankSize": 50, // optional
     "restTime": 3,  // optional
     "fuelType": "ethanol" // optional
 }

Generate Map Link:

URL: /calculate-trip/map-link

Method: GET

Parameters:

  "origin": "Origin location"
  "destination": "Destination location"

License

This project is licensed under the MIT License. See the LICENSE file for more details.

distance-calculator's People

Contributors

aysllagomes avatar

Watchers

 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.