November 2013
Intermediate to advanced
148 pages
3h 12m
English
A single-page web application consists of an HTML page, CSS to style it, and JavaScript to perform the application logic. All of these things can be delivered as static files, meaning they don’t require any special server-side processing. You can just serve them up from the file system.
In this section, you’ll see how to serve static content from Express alongside your RESTful APIs. Some of the static content will come from third-party dependencies, which we’ll pull from Bower.
Express comes with a convenient way to serve static files. All you have to do is use the express.static middleware and provide a directory. For example, these lines appear in the b4 server:
| web-app/b4/server.js ... |
Read now
Unlock full access