These slides are going to walk through setting up a new project in your Codespace where you will do your first web programming.
Make sure you are on the main
branch.
If, for some reason, you are not on main, click the indicator and use the menu to change to main
.
Go to the version control tab.
If you see this, press the “Sync changes” button.
Sync up via ººº ⇨ Pull,Push ⇨ Sync.
This makes sure your Codespace has all the latest changes from your Github repository.
To get the starter code into our Codespace we need to go back to the command line.
As before, right click on the start-project
file in the file explorer and choose “Open in Integrated Terminal”
Now type:
./start-project first-web trivial-web
and hit return.
You should see something like this:
The start-project
script created a branch for your new project and a directory under projects
matching the branch name, then fetched the starter code and installed some libraries you’ll need.
If you click the triangle next to the projects
folder in the file explorer it should show you some new files.
Now right click on first-web
and choose “Open in Integrated Terminal”. In the new terminal type:
node index.js
You should see:
At the bottom right of the screen, this dialog should pop up:
Choose “Preview in Editor” for now.
Congratulations! You have successfully started a web server and served up a page of HTML!
🎉🎉🎉
Before you do anything else, use the version control icon in the sidebar to commit the new files.
Now navigate to first-web/public/index.html
in the file explorer and click on it to open it in an editor.
Then play with the HTML and click the reload button to refresh the page.
Add more paragraphs.
Add <b>
and <i>
tags to bold and italicize some text.
Make a list with <ul>
and <li>
tags.
Look back at MDN html basics for more ideas.
Whenever you make some interesting changes, you should commit them with a descriptive commit message. This makes it easier to see what you were doing and also creates checkpoints that you can go back to if you want to later.
At the end of class, go to the Github website and create a pull request for the projects/first-web
branch and request my review.