Skip to content

Latest commit

 

History

History
234 lines (151 loc) · 10.1 KB

README.md

File metadata and controls

234 lines (151 loc) · 10.1 KB

node_world_server

This is a web application to display current time, date and weather around the world for every timezones in every countries and many other things. This web application is available in four languages (French, English, Spanish and Catalan) which can be switched.

Contents

  1. What is this project ?

  2. How is it structured ?

  3. How to run this web app ?

  4. How to run this web app locally only ?

  5. A few usefull links

  6. What is used in this project ?

  7. Conclusion

What is this project ?

This project consists to develop a web application to . It can be used in several cases:

  • Create a desk clock or a nice gift during a maker project,

  • build your own alarm clock in a maker project,

  • use it in many other maker projects limited by our own imagination,

  • learn much about using weather (via OpenWeatherMap API) and GitHub API to get informations and make some statistical calculus,

  • learn NodeJS in details and use this technology to learn web development,

  • use it in NodeJS and web development courses or tutorials,

  • many other things limited by our own imagination

You can now access some examples in the 'projects_examples' folder, just here.

How is it structured ?

How to run this web app ?

by the source code...

The source code of the node_world_server web app is available on GitHub. You must install the latest versions of Git, Node.js and NPM. For more information, go to the Requirements and installation section. To install and run the node_world_server web app, please run these following commands in order:

# Cloning the `node_world_server` project from GitHub...
$ git clone https://github.com/Vicken-Ghoubiguian/node_world_server

# Changing the current folder for the project's one...
$ cd node_world_server

# Installing all required NPM packages listed in the 'package.json'...
$ npm install

# Running the web app passing in parameter `openWeatherAPIKey` (corresponding to the OpenWeather API key) and `fontAwesomeKit` (corresponding to the Font Awesome kit) both required to run it...
$ npm start -- --openWeatherAPIKey="<your_openweather_API_key>" --fontAwesomeKit="<your_font_awesome_kit>"

Congratulations, now the node_world_server web application is working. To access this application, type the following address in the bar of your browser: http://localhost/. You can also type in the search bar in the browser of your choice from the device (connected on the same network as the host of course) of your choice the host's IP adress.

It's now your turn to play. Now enjoy...

For more informations

  • How to get an OpenWeather API key ?

To have an OpenWeather Map API key, you must first create an account from the official website just here. It is from this newly created account that you can generate and manage as many OpenWeather Map API keys as you want.

If you don't have an account, you can create it while creating your free Font Awesome kit from right here.

For more informations, you can read the documentation still on the official website.

  • How to get a Font Awesome Kit ?

To have a Font Awesome kit, you must first create an account from the official website just here. It is from this newly created account that you can generate and manage as many Font Awesome kits as you want.

If you don't have an account, you can create it while creating your free Font Awesome kit from right here.

For more informations, you can read the documentation still on the official website.

by Docker...

requirements

Docker...

from the Dockerfile

A Dockerfile is available in the project root, and you can consult it here. To deploy this web app by the Dockerfile, please follow these commands in order:

# Creating the node_world_server Docker image with all the values ​​for the defined parameters "user_owm_api_key" (corresponding to the user's OpenWeatherMap API key) and "user_fa_kit" (corresponding to the user's Font Awesome kit)...
docker build . -t node_world_server:latest --build-arg user_owm_api_key="<wished_openWeatherMap_API_key>" --build-arg user_fa_kit="<wished_font_awesome_kit>"

# Seeing the list of all the executed instructions to create the node_world_server Docker image (optional)...
docker image history node_world_server:latest

# Running the Docker container node_world_server from the Docker image of the same name...
docker container run -d --name node_world_server -p 80:80 node_world_server:latest

# Checking the IP address of the Docker container of the node_world_server application (optional)...
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' node_world_server

Congratulations, now the node_world_server web application is working. To access this application, type the following address in the bar of your browser: http://localhost/. You can also type in the search bar in the browser of your choice from the device (connected on the same network as the host of course) of your choice the host's IP adress.

It's now your turn to play. Now enjoy...

from Docker Hub

A Docker image is available on Docker hub just here. To deploy this web app by the image on Docker hub, please follow these commands in order:

# Pulling the official Docker image from Docker Hub...
docker pull wicken/node_world_server

# Running the Docker container node_world_server from the offical Docker image from Docker Hub...
docker container run -d --name node_world_server -p 80:80 wicken/node_world_server

# Checking the IP address of the Docker container of the node_world_server application (optional)...
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' node_world_server

Congratulations, now the node_world_server web application is working. To access this application, type the following address in the bar of your browser: http://localhost/. You can also type in the search bar in the browser of your choice from the device (connected on the same network as the host of course) of your choice the host's IP adress.

It's now your turn to play. Now enjoy...

with Balena...

What is Balena ?

Tutorial on Balena

How to run this web app locally only ?

Why run this web app locally only ?

How do it from source code ?

How do it by Docker ?

Running the web app locally using Docker is very easy. All of the commands, except the last one, are similar to those discussed earlier here and here, whether you're using the project's Dockerfile or the image pulled from the Docker hub. First, let's start by seeing the procedure to follow when using the Dockerfile (you must follow all of these commands in order):

# Creating the node_world_server Docker image with all the values ​​for the defined parameters "user_owm_api_key" (corresponding to the user's OpenWeatherMap API key) and "user_fa_kit" (corresponding to the user's Font Awesome kit)...
docker build . -t node_world_server:latest --build-arg user_owm_api_key="<wished_openWeatherMap_API_key>" --build-arg user_fa_kit="<wished_font_awesome_kit>"

# Seeing the list of all the executed instructions to create the node_world_server Docker image (optional)...
docker image history node_world_server:latest

Now in a second time, let's see the procedure by using the Docker image of the web app on Docker hub:

# Pulling the official Docker image from Docker Hub...
docker pull wicken/node_world_server

It is now time to get the web application running and it is this single command (which is also the very last) that makes all the difference with the previous ones:

# Running the Docker <'node_world_server' or 'wicken/node_world_server' in this explanation> container from the Docker image of the same name and which will run locally...
docker container run -d --name <'node_world_server' or 'wicken/node_world_server' in this explanation> -p 127.0.0.1:80:80 node_world_server:latest

explanations:

How do it with Balena ?

A few usefull links

What is used in this project ?

Conclusion