Skip to content

Latest commit

 

History

History
94 lines (36 loc) · 2.47 KB

readme.md

File metadata and controls

94 lines (36 loc) · 2.47 KB

Building Web Application Front-End

This tutorial will walk you through the creation of the Fair Change Website Front End. The goal of this website is to show the details of each incidident in a map view. The website is built with React and it uses Google Maps to populate each incident submited from the Mobile app or in the database.

Learning objectives

In this tutorial, you will:

  • Learn how to stand up a Node.js React App
  • Connect the back-end application with the front-end
  • Test and run the application locally
  • Deploy Deploy the application on IBM Cloud as a Cloud Foundry application.

Here is a demo of the final application:

Prerequisites

To complete the steps in this tutorial you need to complete all the steps to get the back-end application running.

Follow these instructions for setting up the web application's back end

Estimated Time

This tutorial will take you about 30 minutes to complete.

Steps

The following steps assume that you have the back-end application up and running.

Running locally

Once you have the back-end application up and running you will need to :

  1. Change dirctory and go to the website folder

cd website

  1. Create a Google Maps API Key by following these instructions : https://developers.google.com/maps/documentation/embed/get-api-key

  2. Once you have Google Maps API key add your API Key to const googleMapsApiKey = (line 7) in the app.tsx file

  3. Once you have set your Google Maps API Key navigate to /website/scripts/webpack.config.js . Line 3 of webpack.config.js includes a constant called apiServer which will be the endpoint where your back-end service is running.

If your back end service running locally set that variable to http://[::1]:3000 . If your back end service is running on the cloud make sure you change that endpoint accordingly to your back-end endpoint.

  1. Install the dependencies:

    npm install
    
  2. If you plan to run locally , make sure your back-end is also running and then run the front-end application with:

    npm run dev
    
  3. You should see your website running on http://localhost:9000/

gif1

Deploy to IBM Cloud as a Cloud Foundry application