How To Be MEAN: Express Input.

Ted Neward. 2015-12-01.
Ted NewardWelcome back, “Nodeists.” (I established that as the semi-official term of endearment for those who use Node.js on a regular basis. If you don’t care for it, drop an e-mail or a tweet with a better suggestion, bearing in mind my other two ideas were “Noderati” or “Nodeferatu.”)
In the previous installment, the application had grown to include some output capabilities, in the form of Web API endpoints for obtaining either the collection of persons (my resource for this application; I seem to be building some kind of people database) or the individual person via an arbitrary “id” given as part of the URL. It’s time to start processing input—the ability to put a new person into the system, remove a person from the system and update an existing person. In some ways, these are “just” new URL endpoints to the application, but there are a few new tricks I want to talk about along the way.
As I mentioned last time, those who are interested in seeing the latest-and-greatest of the code being written as part of this series can visit the Microsoft Azure site that holds the latest of this series’ code (msdn-mean.azurewebsites.net). It’s likely that the text here is out of sync with what’s on the site, given publication schedules, but if anything, the site will be ahead of what’s here, giving readers a look ahead at what’s to come next.
Speaking of the last column, as of the last installment, the code can display existing people in the database, but there’s no modification of them whatsoever yet. Because that’s usually a critical part of any online system, let’s add the “CUD” to the “R” to finish out the CRUD.

[How To Be MEAN: Express Input]

Advertisements

How To Be MEAN: Express Routing

Ted Neward. MSDN Magazine. 2015-11-01.
Welcome back, “Nodeists.” (I have no idea if that’s the official term for those who use Node.js on a regular basis, but Nodeists sounds better to me than “Nodeheads” or “Noderati” or “Nodeferatu.”)
In the last installment (msdn.com/magazine/mt573719), the application’s stack had gone from being an “N” stack (just Node) to an “EN” stack by virtue of installing Express to go along with the Node.js. As tempting as it would be to jump directly onto other things, there are a few more things about Express—and its supporting packages and libraries—that deserve exploration and further discussion. You previously got a taste of one of these, Express routing, when the code set up a function to display “Hello World” in response to HTTP requests to the “/” relative URL path. Now, I’ll go a little deeper into the Express world and show you how to use it more effectively.
By the way, those who are interested in seeing the latest-and-greatest code being written as part of this series can visit the Microsoft Azure site that holds the most recent of this series’ code (msdn-mean.azurewebsites.net). It’s likely that the information in this column is out of sync with what’s on the site, given publication schedules, and the site gives readers a look at what’s to come.

[How To Be MEAN: Express Routing]

How To Be MEAN: Express Input.

Ted Neward. 2015-12-01.
Ted NewardWelcome back, “Nodeists.” (I established that as the semi-official term of endearment for those who use Node.js on a regular basis. If you don’t care for it, drop an e-mail or a tweet with a better suggestion, bearing in mind my other two ideas were “Noderati” or “Nodeferatu.”)
In the previous installment, the application had grown to include some output capabilities, in the form of Web API endpoints for obtaining either the collection of persons (my resource for this application; I seem to be building some kind of people database) or the individual person via an arbitrary “id” given as part of the URL. It’s time to start processing input—the ability to put a new person into the system, remove a person from the system and update an existing person. In some ways, these are “just” new URL endpoints to the application, but there are a few new tricks I want to talk about along the way.
As I mentioned last time, those who are interested in seeing the latest-and-greatest of the code being written as part of this series can visit the Microsoft Azure site that holds the latest of this series’ code (msdn-mean.azurewebsites.net). It’s likely that the text here is out of sync with what’s on the site, given publication schedules, but if anything, the site will be ahead of what’s here, giving readers a look ahead at what’s to come next.
Speaking of the last column, as of the last installment, the code can display existing people in the database, but there’s no modification of them whatsoever yet. Because that’s usually a critical part of any online system, let’s add the “CUD” to the “R” to finish out the CRUD.

How To Be MEAN: Express Input.

How To Be MEAN: Express Routing

Ted Neward. MSDN Magazine. 2015-11-01.
Welcome back, “Nodeists.” (I have no idea if that’s the official term for those who use Node.js on a regular basis, but Nodeists sounds better to me than “Nodeheads” or “Noderati” or “Nodeferatu.”)
In the last installment (msdn.com/magazine/mt573719), the application’s stack had gone from being an “N” stack (just Node) to an “EN” stack by virtue of installing Express to go along with the Node.js. As tempting as it would be to jump directly onto other things, there are a few more things about Express—and its supporting packages and libraries—that deserve exploration and further discussion. You previously got a taste of one of these, Express routing, when the code set up a function to display “Hello World” in response to HTTP requests to the “/” relative URL path. Now, I’ll go a little deeper into the Express world and show you how to use it more effectively.
By the way, those who are interested in seeing the latest-and-greatest code being written as part of this series can visit the Microsoft Azure site that holds the most recent of this series’ code (msdn-mean.azurewebsites.net). It’s likely that the information in this column is out of sync with what’s on the site, given publication schedules, and the site gives readers a look at what’s to come.

[How To Be MEAN: Express Routing]

Express

Web Applications
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
APIs
With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy.
Performance
Express provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love.
Frameworks
Many popular frameworks are based on Express.

[Express]