Skip to content

This is an rest api that consult weather data from anywhere.

License

Notifications You must be signed in to change notification settings

upALX/Orpen-Weather

Repository files navigation

Orpen Weather

Overview

This is an rest api that consult weather data without the need for identification by the user. After run the app, you can learn about the features and endpoints on Orpen Weather DOCS.

🎆This project is on MVP🎇

giphy


Tech stack

typescript  Node.js  NestJS  postgresql  TypeORM  docker 

How to use 🫁

requirements:

  • Docker >= 24.0.7
  • Docker compose >= 1.29.2
  • Node >= 18.17.1

Please, make sure you have all requirements installed to run this app

1 - Clone this repo:

git@github.com:upALX/Orpen-Weather.git

2 - Install all dependencies:

npm i

3 - As good practice this project use env variables, so on root folder of project, create an file named .env and put the variables:

DB_HOST=LOCALHOST
DB_PORT=5432
DB_USERNAME="alx"
DB_PASSWORD="alxroot"
DB_NAME="orpen_weather_db"
DB_ADMIN_EMAIL="alx@root.com"
API_KEY="2db21560ff5f54c94b8d81e901576f84"

4 - Run on terminal the docker compose to up all services db and admin:

docker-compose up

5 - Access page admin of postgres on host: http://localhost:8081 and create a server to db:

  • Log in using as username: DB_ADMIN_EMAIL value and as password: DB_PASSWORD value in the .env file.
  • On Dashboard, click in 'Add New Server';
  • In 'General', add a Name of your choice to the server;
  • In the Connection tab, fill in the following details:
    • Host name/address: postgres
    • Port: 5432
    • Maintenance database: postgres
    • Username: alx (same value DB_USERNAME of .env file);
    • Password: alxroot (same value DB_PASSWORD of .env file)
  • Click to save connection.

6 - Access the databases and create the tables

  • Into Servers > name you chose for the server > Databases > In orpen_weather_db tab right click;

  • Click in CREATE script;

  • Into page of scripts, remove all the SQL there and put the SQL script below, after that run(F5):

    CREATE TABLE IF NOT EXISTS "weather" (
    id SERIAL PRIMARY KEY,
    weather_key UUID NOT NULL,
    city VARCHAR(85) NOT NULL,
    country VARCHAR(2) NOT NULL,
    weather_data JSONB,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
    );
    CREATE TABLE IF NOT EXISTS "webhooks" (
    id SERIAL PRIMARY KEY,
    webhook_key UUID NOT NULL,
    	city VARCHAR(85) NOT NULL,
    	country VARCHAR(2) NOT NULL,
    	webhook_url VARCHAR(700) NOT NULL,
    	created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
    );
    
    

    Verify into Schemas > Tables if the tables weather and webhooks was created

7 - After that run the application on your IDE-terminal:

npm run start

Now, the API is running 🚀

If you have any problem with connection db, on IDE-terminal in root folder restart the containers with this command:

docker restart $(docker ps -q)

To access all features of this API, click here and learn how to use with the Orpen Weather DOCS.

Make your mark 🚩

If you have any problems with this app or have an idea that contributes, open a issue, pull request or find me on Linkedin. Don't forget to give the project a star 🌟 :D

License 🔓

This project is under the MIT license.


Developed with 💜 by ME

About

This is an rest api that consult weather data from anywhere.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published