Taken from my YouTube Tutorial: https://www.youtube.com/watch?v=6BozpmSjk-Y
To give the completed code a quick test-drive:
- Install Node.js
- Navigate to the project folder and run the following from a terminal:
npm init -y
(to create a Node.js project)npm i express
(to install Express)node server.js
(to run the server)
- Open
localhost
in a web browser, using the port specified inserver.js
e.g. http://localhost:3000/
Refer to the YouTube Tutorial for step-by-step instructions to create the code. Enjoy! :)