Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with RethinkDB

You're reading from  Getting Started with RethinkDB

Product type Book
Published in Mar 2016
Publisher Packt
ISBN-13 9781785887604
Pages 176 pages
Edition 1st Edition
Languages
Author (1):
Gianluca Tiepolo Gianluca Tiepolo
Profile icon Gianluca Tiepolo

Table of Contents (15) Chapters

Getting Started with RethinkDB
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
Preface
1. Introducing RethinkDB 2. The ReQL Query Language 3. Clustering, Sharding, and Replication 4. Performance Tuning and Advanced Queries 5. Programming RethinkDB in Node.js 6. RethinkDB Administration and Deployment 7. Developing Real-Time Web Applications Index

Creating the Node.js server


The first step in developing the notes web application is coding the HTTP server that will serve the clients' requests, so we're going to start with the app.js file.

The HTTP server relies on the Express.js module, so we first need to import the module and all other modules that will be used in the app.

Take a look at the following code:

var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io')(server),
path = require('path'),
bodyParser = require('body-parser'),
model = require('./models/rethinkdb');

These seven lines actually do quite a bit of work! Let's go through them line by line.

The first line imports the Express.js module and makes it accessible through the express variable so that we can use it in the script.

Line number two creates a new instance of an Express.js app, while line three imports the http module and uses the app variable to create an instance of an HTTP server.

Line number four imports...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}