Setting Up Express Welcome to Setting up Express. This is the next module in our series about Building Web Applications with Node. js and Express, and I'm Jonathan Mills from Pluralsight. So in this module we're going to continue this process of building out a web application using Node and Express. We're going to get Express configured, we've started writing a little bit of code, but not very much. In this module we'll get Express set up, it'll be working, it'll be running. We're going to do some very simple routing. We're going to go get a Bootstrap template and we'll play around with that a little bit, and we'll also talk about Bower, which is a front-end package manager, as opposed to npm, which is more of our back-end package manager. Alright, so what are we doing here? We're going to build out a library application. We got to build something so we might as well build this. I read a lot of books. And so we're going to build out an application that's going to keep track of authors, and books, and how those two things tie together, and so there's a lot of things we can do with that and it kind of let's us go in a bunch of different ways, so that's what we're going to do. We're even going to, in the end, tie in with some third-party APIs to pull data down off the internet, so it's a nice little tie in we can do towards the end. So let's get started, let's pop back over to our code that we've started writing and we'll start pulling Express into this and get that moving.
Templating Engines Welcome to Building Web Apps with Node. js and Express 4. In this module we're going to start talking about templating engines. Now we're walking down the path of building out a web application using Node. js and Express, and we've gotten all of the frameworks set up, kind of all the extra stuff, now it's time to actually dig in and start building our application. And to start off we're going to talk about templating engines. Now a templating engine is just something that we're going to use to allow Express to build our HTML pages for us. That way it can embed some pieces of information that it's pulled from an API, or a database, or somewhere, and drop that into the HTML. Now there's a couple of different kinds of templating engines that we're going talk about. We're going to start by talking about Jade. So Jade is a templating engine that has to be compiled, and so I'll tell you the syntax, and how to use Jade, and get that going. Then we'll expose you to Handlebars, which is just another type of templating engine that works just a little bit differently than how Jade works. And then we're going to end with EJS, and EJS is the one we're going to use over the course of this application, in this course, but I want to expose you to a couple of different types because depending on what you're doing, Jade or Handlebars might be a better fit for your environment.
Routing So we're moving right along in our course to build out a web app with Node. js and Express. And in this module we're going to talk about Routing. Now we're pretty far along in this process of building out this web app, but we haven't really done anything with the application itself yet. We've built the scaffolding, we've talked about templating engines, we've done all those things, now it's time to get down to actually building out our web application. And we're going to start by building some routes for our application, we've got book routes and author routes. We're building a library application that's going to keep track of some books for us, and so we've got book routes and author routes. And we're going to build out /books, /author, all those types of things. And so by the end of this module we'll actually have what looks like a working web application, and then we'll start hooking up databases and all of that stuff after that. So let's get started.
Databases I'm Jonathan Mills, and in this module we're going to start talking about Databases and how to hook our web application up to a couple of different types of databases. Now we're building in our web application and we're working through, we've got some routes, we've got some data, but now we want to start pulling data out of a database to display that out to our website. Now, typically in a Node. js course you're not going to deal with SQL Server, a lot of times a lot of these course, and a lot of blogs, and a lot of tutorials, everything deals with MongoDB. And not everybody wants to use MongoDB so we're going to intentionally do something a little different. We're going to use SQL Server. So, if you have access to SQL Server and that's what you want to use for your back-end, we're going to show you how to do that. I'm going to use an Azure instance of SQL Server, but if you've got a local instance, or SQL Express, or something like that, this will all work just fine. We're also going to look at MongoDB. MongoDB seems to be the standard, it's what a lot of people use, we're going to use just the native MongoDB in this, there's a lot of courses out there on Mongoose if you want to use more of an ORM type environment, you can look at my RESTful APIs course or there's a Mongoose course out there, and there's other things. So I'm going to intentionally do things that aren't covered already in a lot of the other courses, or a lot of other tutorials out there. So, first we're going to start with SQL Server and get data out of an Azure SQL Server database.
Authentication I'm Jonathan Mills, and in this module we're going to tackle Authentication. So we're working our way through building out a web application. We're building a library app, we're looking at books, and authors, and listing books, and all of that kind of stuff, and we've come quite a ways. We've got a page up, we've got all of our scaffolding up, we're pulling out of a database now, we looked at SQL Server, we looked at MongoDB, and now we're going to start creating users. So I'm going to create a user account and then allow myself to log in as that user over time. We're going to cover authentication, which means we're going to sign in, username, password, we're going to check the password, we're going to do all of that kind of stuff. We're also going to look a little bit at authorization, meaning as a logged in user I'm going to have access to somethings that non-logged in users won't have access to, and I'll show you how to work through all of that. And we're going to do all of this using Passport. And Passport is an authentication framework that's fairly standard in the Node/Express world, and this is what most people seem to be using when they're dealing with this type of thing. And Passport is going to do a lot of the heavy lifting for us as we work through this process.
Structure and 3rd Party APIs I'm Jonathan Mills, and in this module we're going to start talking about code structure, and also start to implement some third-party APIs so that we can pull data from someone else. Now we're almost done building out our web application. We've got everything put together, we've got a lot of different routes going, we've got data coming from a database, we're saving data from creating a user, and we have implemented Passport and authentication, and we've got all of the pieces of a website going, and now we're going to start cleaning it up a little bit. So we're going to talk a little bit about code structure and implement some controllers. And right now everything's in our router, so when I go to /book I've got all of my code that handles that get right there in one place. And we're going to pull that out a little bit into a separate file so that we can keep a separation of concerns and things will be a little cleaner. We're also going to implement services, so I'm going to show you how to implement a service that's going to deal with all of our third-party HTTP calls. And we're going to start calling a third-party API, in this case it's going to be an API called Goodreads, that we're going to use to pull book information out of so that we can show additional information on that single book page.