Our first Hello World example was great and all, but while the console is extremely helpful for debugging, we actually want to put things in the browser, don’t we? So let’s do that now!
To be able to access our code from a webbrowser we will need a server. The standard-server for NodeJS is ExpressJS, so that’s what we will be using as well. We install it using npm from within your project-directory:
|
|
Now we just completely override our server.js
with the following piece of code:
|
|
Fire up the server (if not still running) using
|
|
then open your browser, visit localhost:8080, check out all the cool things that are happening and be amazed! Well, it’s really just text so far, so don’t waste your time waiting for something special to come up here^^ - but don’t worry, there are special things to come!