Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Single-page Web Application Development
  • Table Of Contents Toc
Learning Single-page Web Application Development

Learning Single-page Web Application Development

By : Fernando Monteiro
3 (1)
close
close
Learning Single-page Web Application Development

Learning Single-page Web Application Development

3 (1)
By: Fernando Monteiro

Overview of this book

This book is aimed at web developers who are familiar with frontend technologies like JavaScript, HTML, and CSS, and modern tools like Bower, Yeoman, and Grunt.
Table of Contents (10 chapters)
close
close
9
Index

Node server with server.js


With this structure formed, we will start the creation of the server itself, which is the creation of a main JavaScript file.

The most common name used is server.js, but it is also very common to use the app.js name, especially in older versions.

Let's add this file to the root folder of the project and we will start with the basic server settings.

There are many ways to configure our server, and probably you'll find the best one for yourself. As we are still in the initial process, we keep only the basics.

Open your editor and type in the following code:

// Import the Modules installed to our server
var express    = require('express');
var bodyParser = require('body-parser');

// Start the Express web framework
var app        = express();

// configure app
app.use(bodyParser());

// where the application will run
var port     = process.env.PORT || 8080;

// Import Mongoose
var mongoose   = require('mongoose');

// connect to our database
// you can use your own MongoDB...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Single-page Web Application Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon