November 2017
Intermediate to advanced
298 pages
7h 10m
English
There is no easy way around this, but our main application logic file, index.js, won't be as simple as the other configuration files have been:
'use strict'// Load our dependenciesconst bodyParser = require('body-parser')const express = require('express');const mongo = require('mongodb')// Setup database and server constantsconst DB_NAME = 'word_database';const DB_HOST = process.env.DB_HOST || 'localhost:27017';const COLLECTION_NAME = 'words';const SERVER_PORT = 8000;// Create our app, database clients, and the word list arrayconst app = express();const client = mongo.MongoClient();const dbUri = `mongodb://${DB_HOST}/${DB_NAME}`;const words = [];// Setup our templating engine and form data parserapp.set('view engine', ...Read now
Unlock full access