Node.js - app.get() route

Node.js app routes is something that simplifies your API routes. Both for the app itself and for external API requests.

To get startet with get requests use the following code. This code will work after you've setup the necessary requires.

app.get("/page/:pageid/", function(req, res, next) {

	var startdate = req.params.start;
	var enddate = req.params.end;

	switch(req.params.pageid) {
		case '01':	
			//TODO: Show page 1

		case '02':
			//TODO: Show page 1

			//TODO: Handle error



Simple snippets explaining how to handle app.get routes in Node.js with params.

By adding ":param" to your get request, you can simply format your url's accordingly. and ex view different pages with different information depending on the user.

Our url's will look like this: