Create a new node project
npm initAdd a dependency (e.g. lite-server)
npm install lite-server --save-devCreate an entrypoint:
vim package.jsonMake the following changes:
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "start": "npm run lite",
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "lite": "lite-server"
},Run your app:
npm startNote that npm start will run whatever is in your .scripts.start of your
package.json; .main is the entrypoint. For example, let's say .main
index.html, and these are its contents:
<html>
<title>Dawgs</title>
<body>
<h1>I love muh dawg!</h1>
<p>I really do</p>
<h2>I love muh cat!</h2>
<p>but not as much as muh dawg!</p>
</body>
</html>In that case, the above HTML is displayed on http://localhost:3000 when npm start is run.