Coder Social home page Coder Social logo

elgeorsk / fe-travelapp Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.77 MB

Front End Web Developer Nanodegree - Build a travel app, Utilize multiple APIs to present a user with all they need to know about their trip.

JavaScript 68.47% SCSS 18.78% HTML 12.76%
geonames-api weatherbit-api pixabay-api webpack axios jest-tests supertest toastify-js

fe-travelapp's Introduction

Project Instructions

Build a travel app. Utilize multiple APIs to present a user with all they need to know about their trip.

The APIs that we are going to use in this implementations are:

Getting started

Remember that once you clone, you will still need to install everything:

cd into your new folder and run:

  • npm install

You can run the project in development or production mode by using the following commands:

  • Development mode: npm run build-dev
  • Production mode: npm run build-prod
  • Run tests: npm run test

Note: scripts can be found in package.json

Setting up the APIs

1. GeoNames

The GeoNames geographical database covers all countries and contains over eleven million placenames.

Step 1: Signup for API key

Sign up here and get your API key.

Step 2: Fetch data

Here is the documentation for GeoNames Search Webservice.

2. Weatherbit.io

Weather API you can retrieve current weather observations from over 47,000 live weather stations, historical weather data for the past 10 years from our archive of more than 120,000 stations, and highly localized weather forecasts for any point on the globe using the world's most trusted weather models.

Step 1: Signup for API key

Sign up here and get your API key.

Step 2: Fetch data

Here is the documentation for Current Weather API.

3. Pixabay

RESTful interface for searching and retrieving free images and videos released under the Pixabay License.

Step 1: Signup for API key

Sign up here and get your API key.

Step 2: Fetch data

Here is the documentation for Current Weather API.

let API_KEY = PIXABAY_API_KEY;
let URL = "https://pixabay.com/api/?key="+API_KEY+"&q="+encodeURIComponent('red roses');
$.getJSON(URL, function(data){
        if (parseInt(data.totalHits) > 0)
                $.each(data.hits, function(i, hit){ console.log(hit.pageURL); });
        else
        console.log('No hits');
        });

4. Environment Variables

Environment variables are pretty much like normal variables in that they have a name and hold a value, but these variables only belong to your system and won't be visible when you push to a different environment like Github.

  • Use npm or yarn to install the dotenv package npm install dotenv. This will allow us to use environment variables we set in a new file
  • Create a new .env file in the root of your project
  • Go to your .gitignore file and add .env - this will make sure that we don't push our environment variables to Github! If you forget this step, all of the work we did to protect our API keys was pointless.
  • Fill the .env file with your API keys like this:
GEONAMES_USERNAME=**************************
WEATHERBIT_API_KEY=**************************
PIXABAY_API_KEY=**************************
  • Add this code to the very top of your server/index.js file:
const dotenv = require('dotenv');
dotenv.config();

Deploying

A great step to take with your finished project would be to deploy it!

Checkout Netlify or Heroku for some really intuitive free hosting options.

fe-travelapp's People

Contributors

elgeorsk avatar

Watchers

 avatar  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.