Weather widget written as a code challenge using NodeJS Express and React.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Clone this repository
git clone https://github.com/damjtoh/weather-widget.git
cd weather-widget
- Install dependencies, for server and client.
npm install && cd client/ && npm install
-
Rename
.env.example
file to.env
-
Set up your OpenWeather API KEY as shown below
OPENWEATHER_API_KEY=HERE_GOES_YOUR_API_KEY
- Build and run the aplication.
npm run start
This command will transpile the nodejs app and make a production build of the react app and serve it on 8080 port.
- Go to
http://localhost:8080
For testing the NodeJS app run the script
npm run test
For testing the React app run
npm run test-client
Check out others script at the root package.json
file:
"scripts": {
"dev": "NODE_ENV=development nodemon -w src --exec \"babel-node src --presets es2015,stage-0\"",
"build": "babel src -s -D -d dist --presets es2015,stage-0",
"start": "node dist",
"start-client": "cd client/ && npm run start",
"prestart": "npm run build-both",
"lint": "eslint src",
"lint-client": "cd client/ && eslint src",
"test": "mocha --require babel-core/register --require should --timeout 10000 --watch --recursive './src/tests/*.test.js'",
"test-client": "cd client/ && npm run test",
"build-client": "cd client/ && npm run build && mv build ../dist/client",
"build-both": "npm run build && npm run build-client",
"prebuild-both": "rm -rf ./dist"
},
MIT