I was fascinated that I created my own server that runs like the live server extension of vscode. With this custom activity that I made, I apply my knowledge with HTML Templating as well as making Route Handlers and some basic stuffs like advance array methods and POJO manipulation. I was also introduce with new packages namely http and fs modules.
- Create a server directory
- Inside the server folder, create 2 folders
- assets <= this is where css or image files will be stored
- views <= this is where html documents will be stored
- Create a file server.js
- cd into the server directory
- npm init -y <= creates package.json
- Import modules
- const http = require('http'); <= Creates a server
- const fs = require('fs'); <= Reads a file and convert it into string