MLH-Fellowship / prep-project-22.OCT.PREP.1

MLH Prep Project for Pod 22.OCT.PREP.1
https://prep-project-22-oct-1.netlify.app/
MIT License
2 stars 15 forks source link

MLH Prep Project

MLH Prep Project for Pod 22.OCT.PREP.1

Table of contents

Local Project Setup

Follow the steps below to setup the project on your local machine according to the operating system you are using.

Windows

Using npm

You can skip this step if you have node installed on your system.

Open the link below to install Node.js and npm on your system.

https://nodejs.org/en/download/

npm install

You can generate an api key by clicking on this link.

REACT_APP_APIKEY=Your_Api_Key
REACT_APP_GEOKEY=Your_Api_Key
REACT_APP_AUTOCOMPLETE_LOCATION_APIKEY=Your_Api_Key
REACT_APP_ALERTKEY=Your_Api_Key
REACT_APP_WEEKLYFORECASTAPIKEY=Your_Api_Key
npm start

You can view your project at http://localhost:3000/.

Using yarn

You can skip this step if you have node installed on your system.

Open the link below to install Node.js and npm on your system.

https://nodejs.org/en/download/

You can skip this if you have the yarn installed on your system. Make sure it is the latest stable version.

Run the following command in Powershell.

npm install --global yarn
yarn install

or simply

yarn 

Note: The yarn.lock may cause issues with the installation of dependencies. If you face this issue, try deleting the yarn.lock file and repeat the command above.

yarn start

Linux

Using npm

You can skip this step if you have curl installed on your system.

sudo apt install curl

You can skip this step if you have node installed on your system. Make sure it is the latest stable version.

Open the link below to install Node.js and npm for your specific distribution.

https://github.com/nodesource/distributions/blob/master/README.md

npm install
npm start

You can view your project at http://localhost:3000/.

Using yarn

You can skip this step if you have curl installed on your system.

sudo apt install curl

You can skip this step if you have node installed on your system. Make sure it is the latest stable version.

Open the link below to install Node.js and npm for your specific distribution.

https://github.com/nodesource/distributions/blob/master/README.md

You can skip this if you have the yarn installed on your system. Make sure it is the latest stable version.

npm install --global yarn
yarn install

or simply

yarn 
yarn start

Docker Setup

!!! Have your environment file ready before running the container !!!

This project contains 2 Dockerfiles := Dockerfile.dev and Dockerfile.prod for development and production environment respectively.

These 2 enviroments are :-

  1. react-dev := For running the app in development setting
  2. react-prod := For running on production ecosystem.

In order to run them simply choose from one of the above and replace them for env-name

$ docker-compose up <env-name>

Both of these environment would be live at localhost:3000

Make Your Own Image

To make your own image, choose from any of the above mentioned Dockerfile and simply run

$ docker build -t <image_name> -f <dockerfile_name> .

Environment Variables

Create a .env file to insert your API keys. You can refer to the example.env format for more information.

REACT_APP_APIKEY
REACT_APP_GEOKEY
REACT_APP_AUTOCOMPLETE_LOCATION_APIKEY

Add the following in your .env file and replace Your_Api_Key with the API key generated

REACT_APP_APIKEY=Your_Api_Key
REACT_APP_GEOKEY=Your_Api_Key
REACT_APP_AUTOCOMPLETE_LOCATION_APIKEY=Your_Api_Key