Question

I am developing JavaScript library with node.js for client side. As its client side, I would like to include the library in html page and check the changes while developing the lib. I saw some libraries like Hammer.js that contains examples folder. This setup suits to my requirement. My question here is how to run these examples while developing in node.js environment?

  • Should it be through creating a server.js (node.js app that servers html page)? If yes should i include the same (server.js) in github project or not, as I see no one has included such files. How these developers are doing that must be the standard way.

  • Should I create a separate sandbox or application (for serving html, css and js files) that include the my library js file?

No correct solution

OTHER TIPS

NodeJS is about executing Javascript on a server, without any interaction to a web page. In short: with files and network access, but without browser.

If you wan't to create a JS library intended to run inside a web page, you don't need NodeJS.

You can use it to have a small HTTP server and to host your static files, but you can do it in any langage you want. In fact, in the case of Hammer, the example files can be run locally by the browser itself... You don't even need a static web server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top