For AJAX requests, we usually don’t want to send back HTML. Express makes it really easy to send back JSON for AJAX requests.
- [Presenter] We're halfway through section five now.…We've learned all about Middleware…and mounting sub-application.…In this video, we'll be taking a look at serving content…conditionally depending on if the incoming request…has a flag set.…To say it's an AJAX request, we're going to take a look…at how to detect if a request has been made via AJAX,…how to return data in a different format…if it is an AJAX request,…and how to write a middleware that'll make life easier…when we're dealing with an AJAX request.…
In this video, we'll be making changes to the popular page.…By default, the page renders all the images.…This is great for when people first visit the page,…but if we wanted to expose the data to another app,…it's not in a very easy-to-consume format.…Instead of sending back the images, if it's an AJAX request,…let's just send back the data as JSON.…So let's edit our popular route.…jQuery adds a special header to all of its AJAX requests,…which we can use to send back raw data…instead of a rendered page.…
To start, author Michael Heap creates a new Express application, showing how to configure it and increase application visibility with logs. Explore Express along with various libraries that will help improve your development experience. Then take a look at technologies such as SSL and nginx, and work through deploying your application to production in a secure and scalable way. Michael also introduces some existing open-source Express projects and reviews how they are structured, to help you organize your own applications in a systematic way. By the end of the course, you'll be familiar with a wide range of new Express tools and libraries, all of which will help you deliver the best value to your customers.
- Consuming an API
- Showing results on a webpage
- Caching requests in memory
- Refactoring for testing
- Mocking to remove dependencies
- Spying with Sinon.JS
- Sending and receiving data in real time
- Mounting subapplications
- Serving content conditionally for AJAX
- Securing your app
- Improving performance
- Examining large-scale Express apps: Ghost.org and Balloons.IO