Notice that you have a new file in the file-tree: package.json:
//package.json should have content like this{"name":"firebase","version":"1.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC"}
Install webpack in the project
In the Webstorm terminal
Notice that you have a new folder node_modules
Enforce webpack on NPM BUILD
To accommedate webpacks build step (converting multiple javascript files into a single that can be deployed and run)
Create a new directory in the project root called src
Create a javascript file in the srcfolder called index.js such as this:
Create a javascript file the project root called webpack.config.js
Insert the following content in webpack.config.js:
Change package.json to the following
Exercises
The following exercises does not require you to make any styling.
A simple display on an HTML page using an approach such as the following will do just fine:
Each exercise-part (a,b,c) should be contained in its own function.
Exercise 1
In the following dataset:
A) Display a list of names of cities that are not capitals.
B) Display a list of names of cities that are either in USA or China
E) Write a basic input-field in the HTML page. When the user enters a city name in the field and clicks a button, the application will display an alert with "found" or "not found" if the user has inputted a city name in the database.
Exercise 2 (Advanced)
Create a new project
Insert the following data into a new collection
Create a web application such that:
A user can enter a product name in a text input field and click a button.
The amount of stock of the product will be displayed on the page (styling is not important)
The category of the product will be displayed
The brand will be displayed
If the product is not found - an alert will inform the user
data = ["bob","alice","karsten"] //This data should be fetched from Cloud Firestore
data.foreach((e) =>{
let li = document.createElement('li');
li.innerText = data[i];
list.appendChild(li)
});