A project to play around with JavaScript in Node.js. Will feature various common design patterns and libraries, and shows how you can host js, css and html files using Node.js.
- express
- using middleware
- your own middleware
- server-sent events
- set it up
- send from the server
- read from the client
- using a "let's encrypt" sll certificate and automatically updating it
- js DOM selectors (no jQuery)
- by id
- by tag
- by class
- first in a specified query
- all in a specified query
- AJAX calls without jQuery
- using express static folders to host client js files
- dynamically create a script block and serve it through a route as a file
- using express routers to route http requests:
- get
- post
- combining AJAX calls with express routing
- get
- client-side call
- server-side route
- post
- client-side call
- server-side route
- get
- responsive css
- JSON models
- mongodb
- Promises
- create
- use
- map
- reduce
- error handling
- logging
- minify and concatenate client scripts and style sheets
- add web app manifest
- add a favicon.ico
- manipulate browser history
- add a service worker (for offline caching)
You can run the following commands in your shell to get and run the code:
$ git clone https://github.com/SubliemeSiem/js-playground.git
$ cd js-playground
$ npm install
$ node start [portnumber]
where [portnumber] is the port which you want express to listen to (defaults to 4000 when left blank). To visit the page, browse to http://localhost:[portnumber]. To see the mobile or tablet version, browse to http://[ip]:[portnumber], where [ip] is the ip address of the system running Node.js, using a phone or tablet that is connected to the same network. To get ssl to work using let's encrypt, you'll need some sort of static address. This may be an address provided by a DDNS service, or a static ip address. Details about the configuration for let's encrypt can be found in (not implemented yet).