This is the best package for creating web with node.js if you don't want to use express js :)
npm i modoole --save
const doo = require('modoole');
//insted of "doo" you can use any other name
doo.web(5000, function(){
//modoole functions(and code)
});
doo.log(content);
content: default = "I'm working!"
In console:
modoole: "content"
- See if the modoole is working
doo.route(fileName, routeName);
fileName: Name of the HTML file that will show on the route. examples: "./index.html", "./routes/aboutus.html"
routeName: Name of the route that will be created. (write without /) default = "" examples: "home", "about us"
doo.route(./index.html);
doo.route(./aboutus.html, aboutus);
on web http://localhost:port/: Contents of ./index.html
on web http://localhost:port/aboutus: Contents of ./aboutus.html
- See if the modoole is working
doo.route(fileName, routeName);
fileName: Name of the HTML file that will show on the route.
routeName: Name of the route that will be created. (write without /) default = ""
doo.route(./index.html);
doo.route(./aboutus.html, aboutus);
on web http://localhost:port/: Contents of ./index.html
on web http://localhost:port/aboutus: Contents of ./aboutus.html
- See if the modoole is working
doo.setViewFolder(folderName);
folderName: path to the folder that will contain all your views default = ""
doo.setViewFolder(./views);
Set the vews folder so you dont need to type it everytime your using doo.routes()
instead of
doo.routes(./views/index.html);
doo.routes(./views/aboutus.html, aboutus);
doo.routes(./views/contacts.html, contacts);
you can use
doo.setViewFolder(./views);
doo.routes(index.html);
doo.routes(aboutus.html, aboutus);
doo.routes(contacts.html, contacts);