4.4 Navigating through your new simulation
Now that we've created a new project with the name newton-raphson
let's go ahead and see what it is all about
4.4.1 Directory Structure
Let's start by going into the phetsims
directory and looking for the
newton-raphson
folder and opening it up, you'll see that the content
looks something like this:
There's a lot of files but lets concern ourselves only with the ones that we need to use:
js
- This folder has all the JavaScript files for your project and this
is where the real development takes place (See What is the js folder?)
build
- This folder contains all the build files (See What is the build folder?)
newton-raphson-strings_en.json
- This file contains the title of your
simulation which is displayed on the lower left corner of the screen
(See What is newton-raphson-strings_en.json?)
newton-raphson_en.html
- This file is the one that is accessed during
development to look at what the simulation looks like so far. (See What is newton-raphson_en.html?)
package.json
- This file includes the version number displayed in the
About dialog and the libraries that are to be included in the build file
like Bamboo, the graphing library. (See What is package.json?)
4.4.2 Accessing your simulation
Now when it comes to actually opening up the simulation web-page, you can’t just open up the newton-raphson_en.html
file because the pathing with the .js
files wouldn’t work without a http server
.
In that regard, that is precisely what we need! Let’s start by opening up a terminal/command prompt window and following these steps:
Assuming your
phetsims
folder is on the desktop, change to the phetsims directory by typing:cd Desktop/phetsims
Now if you have followed the entire section about Cloning phetsims on your local machine then you should have install all the prerequisites for starting a
http server
. All you have to do is type:http-server -c-1
Go ahead and test your server by entering the following path in your web browser:
http://localhost:8080/example-sim/example-sim_en.html