O'Reilly logo

Building Scalable Apps with Redis and Node.js by Joshua Johanan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating CSS and the layout

We need to add two CSS rules to style.css, present in static/css/. Append the following to the file:

.chat-message {padding: 5px; margin: 5px 0;}
.chat-list {max-height: 500px; overflow: auto;}

These just make the chat page look better.

We will now need to add our bower_components directory to be served in Express. Open up app.js and add the following line after the current static line:

app.use(express.static(__dirname + '/static'));
app.use(express.static(__dirname + '/bower_components'));

When there are multiple references to static, Express will go through each directory in order to find the file.

Next, we need to add all our new JavaScript files to the layout and chat page. First, open layout.ejs, present in the views/ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required