May 2018
Intermediate to advanced
492 pages
12h 3m
English
Let's start with app.js, changing its name to app.mjs:
$ mv app.js app.mjs
Change the block of require statements at the top to the following:
import fs from 'fs-extra';import url from 'url';import express from 'express';import hbs from 'hbs';import path from 'path';import util from 'util';import favicon from 'serve-favicon';import logger from 'morgan';import cookieParser from 'cookie-parser';import bodyParser from 'body-parser';import DBG from 'debug';const debug = DBG('notes:debug'); const error = DBG('notes:error'); import { router as index } from './routes/index';// const users = require('./routes/users');import { router as notes } from './routes/notes'; // Workaround for lack of __dirname in ES6 modules ...
Read now
Unlock full access