SlideShare a Scribd company logo
Getting MEAN with Mongo Express Angular and Node
1st Edition Simon Holmes pdf download
https://ebookfinal.com/download/getting-mean-with-mongo-express-
angular-and-node-1st-edition-simon-holmes/
Explore and download more ebooks or textbooks
at ebookfinal.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookfinal
to discover even more!
CoffeeScript Programming with jQuery Rails and Node js 1st
Edition Michael Erasmus
https://ebookfinal.com/download/coffeescript-programming-with-jquery-
rails-and-node-js-1st-edition-michael-erasmus/
Web Development with MongoDB and Node 3rd Edition D’Mello
https://ebookfinal.com/download/web-development-with-mongodb-and-
node-3rd-edition-dmello/
Web Development with Bootstrap 4 and Angular 2 2nd Edition
Sergey Akopkokhyants
https://ebookfinal.com/download/web-development-with-bootstrap-4-and-
angular-2-2nd-edition-sergey-akopkokhyants/
Introducing Elixir Getting Started in Functional
Programming 1st Edition Simon St. Laurent
https://ebookfinal.com/download/introducing-elixir-getting-started-in-
functional-programming-1st-edition-simon-st-laurent/
FXRuby Create Lean and Mean GUIs with Ruby Pragmatic
Programmers 1st Edition Lyle Johnson
https://ebookfinal.com/download/fxruby-create-lean-and-mean-guis-with-
ruby-pragmatic-programmers-1st-edition-lyle-johnson/
RESTful Web API Design with Node js Second Edition Bojinov
https://ebookfinal.com/download/restful-web-api-design-with-node-js-
second-edition-bojinov/
Getting Started with Python and Raspberry Pi 1st Edition
Nixon
https://ebookfinal.com/download/getting-started-with-python-and-
raspberry-pi-1st-edition-nixon/
Web Development with MongoDB and Node Third Edition Bruno
D'Mello Joseph Mithun Satheesh
https://ebookfinal.com/download/web-development-with-mongodb-and-node-
third-edition-bruno-dmello-joseph-mithun-satheesh/
Getting Acquainted with Fractals 1st Edition Gilbert
Helmberg
https://ebookfinal.com/download/getting-acquainted-with-fractals-1st-
edition-gilbert-helmberg/
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
Getting MEAN with Mongo Express Angular and Node
1st Edition Simon Holmes Digital Instant Download
Author(s): Simon Holmes
ISBN(s): 9781617292033, 1617292036
Edition: 1
File Details: PDF, 16.97 MB
Year: 2015
Language: english
M A N N I N G
Simon Holmes
www.it-ebooks.info
Getting MEAN
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
Getting MEAN
with Mongo, Express,
Angular, and Node
SIMON HOLMES
M A N N I N G
SHELTER ISLAND
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com
©2016 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine.
Manning Publications Co. Development editors: Susie Pitzen, Susanna Kline,
20 Baldwin Road Karen Miller
PO Box 761 Technical development editor: Marius Butuc
Shelter Island, NY 11964 Copyeditor: Jodie Allen
Proofreader: Alyson Brener
Technicalproofreaders: Steven Jenkins, Deepak Vohra
Typesetter: Dennis Dalinnik
Cover designer: Marija Tudor
ISBN: 9781617292033
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – EBM – 20 19 18 17 16 15
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
v
brief contents
PART 1 SETTING THE BASELINE .................................................1
1 ■ Introducing full-stack development 3
2 ■ Designing a MEAN stack architecture 24
PART 2 BUILDING A NODE WEB APPLICATION...........................51
3 ■ Creating and setting up a MEAN project 53
4 ■ Building a static site with Node and Express 80
5 ■ Building a data model with MongoDB
and Mongoose 120
6 ■ Writing a REST API: Exposing the MongoDB
database to the application 160
7 ■ Consuming a REST API: Using an API from
inside Express 202
PART 3 ADDING A DYNAMIC FRONT END WITH ANGULAR.........241
8 ■ Adding Angular components to an Express
application 243
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
BRIEF CONTENTS
vi
9 ■ Building a single-page application with Angular:
Foundations 276
10 ■ Building an SPA with Angular: The next level 304
PART 4 MANAGING AUTHENTICATION AND USER SESSIONS......347
11 ■ Authenticating users, managing sessions,
and securing APIs 349
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
vii
contents
preface xv
acknowledgments xvii
about this book xix
PART 1 SETTING THE BASELINE......................................1
1 Introducing full-stack development 3
1.1 Why learn the full stack? 4
A very brief history of web development 4 ■
The trend toward
full-stack developers 6 ■
Benefits of full-stack development 6
Why the MEAN stack specifically? 7
1.2 Introducing Node.js: The web server/platform 7
JavaScript: The single language through the stack 8
Fast, efficient, and scalable 8 ■
Using prebuilt packages
via npm 11
1.3 Introducing Express: The framework 12
Easing your server setup 12 ■
Routing URLs to responses 12
Views: HTML responses 12 ■
Remembering visitors with
session support 13
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS
viii
1.4 Introducing MongoDB: The database 13
Relational versus document databases 13 ■ MongoDB
documents: JavaScript data store 14 ■ More than just
a document database 14 ■ What is MongoDB not
good for? 15 ■ Mongoose for data modeling and more 15
1.5 Introducing AngularJS: The front-end framework 16
jQuery versus AngularJS 16 ■
Two-way data binding: Working
with data in a page 16 ■
Using AngularJS to load new pages 18
Are there any downsides? 18
1.6 Supporting cast 19
Twitter Bootstrap for user interface 19 ■
Git for source control 20
Hosting with Heroku 20
1.7 Putting it together with a practical example 21
Introducing the example application 21 ■ How the MEAN
stack components work together 22
1.8 Summary 23
2 Designing a MEAN stack architecture 24
2.1 A common MEAN stack architecture 25
2.2 Looking beyond SPAs 26
Hard to crawl 26 ■
Analytics and browser history 27
Speed of initial load 27 ■
To SPA or not to SPA? 28
2.3 Designing a flexible MEAN architecture 28
Requirements for a blog engine 29 ■ A blog engine
architecture 30 ■ Best practice: Build an internal API
for a data layer 33
2.4 Planning a real application 34
Planning the application at a high level 35 ■
Architecting the
application 36 ■
Wrapping everything in an Express project 38
The end product 39
2.5 Breaking the development into stages 40
Rapid prototype development stages 40 ■
The steps to
build Loc8r 41
2.6 Hardware architecture 47
Development hardware 47 ■
Production hardware 47
2.7 Summary 49
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS ix
PART 2 BUILDING A NODE WEB APPLICATION ...............51
3 Creating and setting up a MEAN project 53
3.1 A brief look at Express, Node, and npm 55
Defining packages with package.json 55 ■
Installing Node
dependencies with npm 56
3.2 Creating an Express project 58
Installing the pieces 58 ■
Creating a project folder 58
Configuring an Express installation 59 ■
Creating an Express
project and trying it out 61 ■
Restarting the application 62
3.3 Modifying Express for MVC 64
A bird’s eye view of MVC 64 ■
Changing the folder structure 65
Using the new views and routes folders 66 ■
Splitting controllers
from routes 67
3.4 Import Bootstrap for quick, responsive layouts 70
Download Bootstrap and add it to the application 70
Using Bootstrap in the application 70
3.5 Make it live on Heroku 74
Getting Heroku set up 74 ■
Pushing the site live using Git 76
3.6 Summary 79
4 Building a static site with Node and Express 80
4.1 Defining the routes in Express 82
Different controller files for different collections 83
4.2 Building basic controllers 84
Setting up controllers 85 ■ Testing the controllers and routes 86
4.3 Creating some views 87
A look at Bootstrap 88 ■ Setting up the HTML framework with
Jade templates and Bootstrap 89 ■ Building a template 93
4.4 Adding the rest of the views 98
Details page 98 ■ Adding Review page 102
The About page 104
4.5 Take the data out of the views and make them
smarter 106
How to move data from the view to the controller 107
Dealing with complex, repeating data 109 ■ Manipulating the
data and view with code 113 ■ Using includes and mixins to
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS
x
create reusable layout components 113 ■
The finished
homepage 115 ■
Updating the rest of the views and
controllers 117
4.6 Summary 119
5 Building a data model with MongoDB and Mongoose 120
5.1 Connecting the Express application to MongoDB
using Mongoose 122
Adding Mongoose to our application 123 ■ Adding a Mongoose
connection to our application 124
5.2 Why model the data? 130
What is Mongoose and how does it work? 131
5.3 Defining simple Mongoose schemas 134
The basics of setting up a schema 135 ■
Using geographic data
in MongoDB and Mongoose 137 ■
Creating more complex
schemas with subdocuments 138 ■
Final schema 143
Compiling Mongoose schemas into models 145
5.4 Using the MongoDB shell to create a MongoDB database
and add data 147
MongoDB shell basics 147 ■ Creating a MongoDB
database 148
5.5 Getting our database live 152
Setting up MongoLab and getting the database URI 152
Pushing up the data 154 ■
Making the application use
the right database 156
5.6 Summary 159
6 Writing a REST API: Exposing the MongoDB
database to the application 160
6.1 The rules of a REST API 161
Request URLs 162 ■
Request methods 163 ■
Responses and
status codes 165
6.2 Setting up the API in Express 167
Creating the routes 167 ■
Creating the controller
placeholders 170 ■
Including the model 171
Testing the API 172
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS xi
6.3 GET methods: Reading data from MongoDB 172
Finding a single document in MongoDB using Mongoose 173
Finding a single subdocument based on IDs 177
Finding multiple documents with geospatial queries 180
6.4 POST methods: Adding data to MongoDB 187
Creating new documents in MongoDB 188 ■ Creating new
subdocuments in MongoDB 190
6.5 PUT methods: Updating data in MongoDB 193
Using Mongoose to update a document in MongoDB 194
Updating an existing subdocument in MongoDB 196
6.6 DELETE method: Deleting data from MongoDB 197
Deleting documents in MongoDB 198 ■ Deleting a subdocument
from MongoDB 199
6.7 Summary 200
7 Consuming a REST API: Using an API from
inside Express 202
7.1 How to call an API from Express 203
Adding the request module to our project 203 ■ Setting up
default options 204 ■ Using the request module 204
7.2 Using lists of data from an API: The Loc8r
homepage 206
Separating concerns: Moving the rendering into a
named function 207 ■
Building the API request 207
Using the API response data 208 ■
Modifying data before
displaying it: Fixing the distances 209 ■
Catching errors
returned by the API 212
7.3 Getting single documents from an API: The Loc8r
Details page 216
Setting URLs and routes to access specific MongoDB
documents 216 ■
Separating concerns: Moving the rendering
into a named function 218 ■
Querying the API using a unique ID
from a URL parameter 219 ■
Passing the data from the API to
the view 220 ■
Debugging and fixing the view errors 221
Creating status-specific error pages 223
7.4 Adding data to the database via the API:
Add Loc8r reviews 226
Setting up the routing and views 227 ■
POSTing the review
data to the API 231
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS
xii
7.5 Protecting data integrity with data validation 233
Validating at the schema level with Mongoose 234 ■ Validating at
the application level with Node and Express 237 ■ Validating in
the browser with jQuery 239
7.6 Summary 240
PART 3 ADDING A DYNAMIC FRONT END
WITH ANGULAR .............................................241
8 Adding Angular components to an Express application 243
8.1 Getting Angular up and running 244
Uncovering two-way data binding 245 ■ Setting up for greatness
(and JavaScript code) 248
8.2 Displaying and filtering the homepage list 251
Adding Angular to an Express application 251 ■ Moving data
delivery from Express to Angular 252 ■ Using Angular filters
to format data 255 ■
Using Angular directives to create
HTML snippets 259
8.3 Getting data from an API 263
Using services for data 264 ■
Making HTTP requests from
Angular to an API 265 ■
Adding HTML geolocation to find
places near you 268
8.4 Ensuring forms work as expected 274
8.5 Summary 275
9 Building a single-page application with Angular:
Foundations 276
9.1 Setting the groundwork for an Angular SPA 277
Getting base files in place 278
9.2 Switching from Express routing to Angular routing 279
Switching off the Express routing 279 ■ Adding ngRoute
(angular-route) to the application 282
9.3 Adding the first views, controllers, and services 284
Creating an Angular view 284 ■
Adding a controller
to a route 286 ■
Controller best practice: Using the
controllerAs syntax 288 ■
Using services 291
Using filters and directives 294
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS xiii
9.4 Improving browser performance 297
Wrap each file in an IIFE 298 ■ Manually injecting dependencies
to protect against minification 299 ■ Using UglifyJS to minify and
concatenate scripts 300
9.5 Summary 303
10 Building an SPA with Angular: The next level 304
10.1 A full SPA: Removing reliance on the server-side
application 305
Creating an isolated HTML host page 305
Making reusable page framework directives 307
Removing the # from URLs 312
10.2 Adding additional pages and dynamically
injecting HTML 314
Adding a new route and page to the SPA 315
Creating a filter to transform the line breaks 317
Sending HTML through an Angular binding 319
10.3 More complex views and routing parameters 321
Getting the page framework in place 321 ■
Using URL
parameters in controllers and services 323 ■
Building the
Details page view 326
10.4 Using AngularUI components to create a modal
popup 330
Getting AngularUI in place 330 ■ Adding and using a click
handler 332 ■ Creating a Bootstrap modal with AngularUI 333
Passing data into the modal 335 ■ Using the form to submit
a review 337
10.5 Summary 345
PART 4 MANAGING AUTHENTICATION AND
USER SESSIONS...............................................347
11 Authenticating users, managing sessions, and securing APIs 349
11.1 How to approach authentication in the MEAN stack 350
Traditional server-based application approach 350 ■ Full MEAN
stack approach 352
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
CONTENTS
xiv
11.2 Creating a user schema for MongoDB 354
One-way password encryption: Hashes and salts 354 ■ Building
the Mongoose schema 354 ■ Setting encrypted paths using
Mongoose methods 355 ■ Validating a submitted password 357
Generating a JSON Web Token 357
11.3 Creating an authentication API with Passport 360
Installing and configuring Passport 360 ■ Creating API
endpoints to return JSON Web Tokens 363
11.4 Securing relevant API endpoints 368
Adding authentication middleware to Express routes 368
Using the JWT information inside a controller 369
11.5 Creating Angular authentication service 373
Managing a user session in Angular 373 ■ Allowing users to
sign up, sign in, and sign out 374 ■ Using the JWT data in
the Angular service 375
11.6 Creating register and login pages 377
Building the register page 377 ■ Building the login page 380
11.7 Working with authentication in the Angular app 383
Updating navigation 383 ■
Adding user data to a review 386
11.8 Summary 389
appendix A Installing the stack 391
appendix B Installing and preparing the supporting cast 395
appendix C Dealing with all of the views 399
appendix D Reintroducing JavaScript available online only
index 405
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
xv
preface
Back in 1995 I got my first taste of web development, putting together a few pages of
simple HTML for a piece of university coursework. It was a small part of my course,
which was a mixture of software engineering and communication studies. This was an
unusual mixture. I learned the fundamentals of software development, database design,
and programming. But I also learned about the importance of the audience and end-
user and how to communicate with them, both verbally and non-verbally.
In 1998, on the communication studies side of the degree, I was required to write a
publication for an organization of my choice. I decided to write a prospectus for the
school where my mother was teaching at the time. But I decided to do it as a website.
Again this was all front-end work. Fortunately I no longer have a copy of it, as I shudder
at the thought of the code. We’re talking HTML with frames, table layouts, inline styles,
and a smattering of basic JavaScript. By today’s standards it was shocking, but back then
it was quite futuristic. I was the first person at the university to submit a website as a pub-
lication. I even had to tell my instructors how to open it in their browser from the floppy
disk it was submitted on! After it was completed and marked, I sold the website to the
school it was about. I figured there was probably a future in this web development thing.
During the following years I made use of both parts of my degree working as the “web
guy” in a London design agency. Because it was a design agency, user-experience (before
it was called UX) and the front end were crucial. But of course there has to be a back
end to support the front end. As the only web guy I fulfilled both roles as the classic full-
stack developer. There wasn’t much separation of concerns in those days. The database
was tightly coupled to the back end. Back-end logic, markup, and front-end logic all
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
PREFACE
xvi
wove together tightly. This is largely because the project was thought of as a single
thing: the website.
Many of the best practices from this book are borne of the pain of finding out the
hard way over these years. Something that might seem harmless at the time, most def-
initely easier, or sometimes even sensible, can come back to bite you later on. Don’t let
this put you off from diving in and having a go. Mistakes are there to be made, and—
in this arena at least—mistakes are a great way of learning. They say that intelligence is
“learning from your mistakes.” This is true, but you’ll be a step ahead if you can also
learn from others’ mistakes.
The web development landscape changed over the years, but I was still heavily
involved with creating—or managing the creation of—full websites and applications. I
came to appreciate that there is a real art to gluing together applications made from
different technologies. It is a skill in itself; just knowing the technologies and what
they can do is only part of the challenge.
When Node.js came onto my radar I jumped right in and embraced the idea full
on. I had done a lot of context switching between various languages, and the idea of
having a single language to focus on and master was extremely compelling. I figured
that if used in the right way it could streamline development by reducing the language
context shifting. Playing with Node I started to create my own MVC framework, before
discovering Express. Express solved a lot of the problems and challenges I faced when
first trying to learn Node and use it to create a website or web application. In many
ways adopting it was a no-brainer.
Naturally, behind pretty much any web application is a database. I didn’t want to
fall back on my previous go-to option of Microsoft SQL Server, as the cost made it
quite prohibitive to launch small personal projects. Some research led me to the lead-
ing open source NoSQL database: MongoDB. It worked natively with JavaScript! I was
more excited than I possibly should have been about a database. However MongoDB
was different from all of the databases I had used before. My previous experience was
all in relational databases; MongoDB is a document database, and that is something
quite different, making the way you approach database design quite different as well. I
had to retrain my brain to think in this new way, and eventually it all made sense.
There was just one piece missing. JavaScript in the browser was no longer just
about enhancing functionality, it was about creating the functionality and managing
the application logic. Out of the available options I was already leaning toward
AngularJS. When I heard Valeri Karpov of MongoDB coin the term “MEAN stack” that
was it. I knew that here was a next-generation stack.
I knew that the MEAN stack would be powerful. I knew that the MEAN stack would
be flexible. I knew that the MEAN stack would capture the imagination of developers.
Each of the individual technologies is great, but when you put them all together you
have something exceptional on your hands. This is where Getting MEAN comes from.
Getting the best out of the MEAN stack is more than just knowing the technologies, it’s
about knowing how to get those technologies working together.
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
xvii
acknowledgments
I must start with the people who mean the world to me, who inspire me to push myself,
and who ultimately make everything worthwhile. I’m talking about my wife, Sally, and
daughters, Eri and Bel. Everything I do starts and ends with these three ladies.
Thanks of course must go to the Manning team. I know it extends beyond the peo-
ple I’m about to name, so if you were involved in any way then thank you! Here are
the people I have personally dealt with.
Right from the beginning there was Robin de Jongh who was instrumental in get-
ting the project started and also in shaping the book. And many thanks to Bert Bates
for providing great insight and challenging me to justify my thinking and opinions
from an early stage. Those were fun conversations.
Crucial to the momentum and feel of the book were my developmental editors,
Susie Pitzen, Susanna Kline, and Karen Miller. And of course my technical developmen-
tal editor, Marius Butuc. Thanks all for sharp eyes, great ideas, and positive feedback.
The next two people really impressed me with their amount of effort and attention
to detail. So thank you Kevin Sullivan and Jodie Allen for the copyediting and proof-
ing, and for staying on top of everything under increasingly short timeframes.
Last but by no means least for the Manning team is Candace Gillhoolley, who has
been keeping up the marketing pace on the book, giving me the sales numbers to
maintain my motivation.
Manning must also be congratulated for having their Manning Early Access Pro-
gram (MEAP) and associated online author forum. The comments, corrections, ideas,
and feedback from early readers proved invaluable in improving the quality of this
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
ACKNOWLEDGMENTS
xviii
book. I don’t have the names of everybody who contributed. You know who you are:
thank you!
Special thanks for their insights and suggestions to the following peer reviewers
who read the manuscript at various stages of its development: Andrea Tarocchi, Andy
Knight, Blake Hall, Cynthia Pepper, Davide Molin, Denis Ndwiga, Devang Paliwal,
Douglas Duncan, Filip Pravica, Filippo Veneri, Francesco Bianchi, Jesus Rodriguez
Rodriguez, Matt Merkes, Rambabu Posa, and William E. Wheeler. Also to Steven
Jenkins and Deepak Vohra for their final technical proofread of the chapters, shortly
before they went into production.
A couple of extra shout-outs for putting up with me and my late-night technology
discussions are to Tamas Piros and Marek Karwowski. Thanks guys!
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
xix
about this book
JavaScript has come of age. Building an entire web application from front to back with
just one language is now possible, using JavaScript. The MEAN stack is comprised of
the best-of-breed technologies in this arena. You’ve got MongoDB for the database,
Express for the server-side web-application framework, AngularJS for the client-side
framework, and Node for the server-side platform.
This book introduces each of these technologies, as well as how to get them work-
ing well together as a stack. Throughout the book we build a working application,
focusing on one technology at a time, seeing how they fit into the overall application
architecture. So it’s a very practical book designed to get you comfortable with all of
the technologies and how to use them together.
A common theme running through the book is “best practice.” This book is a
springboard to building great things with the MEAN stack, so there is a focus on creat-
ing good habits, doing things the “right way,” and planning ahead.
This book doesn’t teach HTML, CSS, or basic JavaScript; previous knowledge of these
are assumed. It does include a very brief primer on the Twitter Bootstrap CSS frame-
work, and there’s also a good, long appendix on JavaScript theory, best practice, tips,
and gotchas. It’s worth checking out early on. This appendix can be found online at
www.manning.com/books/getting-mean-with-mongo-express-angular-and-node.
Roadmap
This book takes you on a journey through eleven chapters, as follows:
Chapter 1 takes a look at the benefits of learning full-stack development and
explores the components of the MEAN stack.
Licensed to Mark Watson <nordickan@gmail.com>
www.it-ebooks.info
Discovering Diverse Content Through
Random Scribd Documents
Keim, Theodor, 241.
Kreyenbuhl, Johannes, xi.
Last Discourse, 90, 94 ff.
Last Supper, 88 f., 94, 150-5.
Lazarus, Story of, 87 f., 170-2.
Light and Life, 190 f., 201.
Lightfoot, Joseph B., 12, 51 ff.
Local Colour, 129-36.
Logos, Doctrine of the, 185-204, 211 ff.
Loisy, Abbé Alfred, 2, 28, 31, 41, 200-4, 205, 223 f., 256.
Lucius, Ernst, 54 f.
Luthardt, Christoph E., 11.
Malchus, 90.
Matthew, Apocryphal Gospel of, 112 f.
McGiffert, A. Cushman, 19.
Memra, 187.
Messiah, the title, 208, 221 f.
Messianic Expectation, 117, 136-40, 158 f.
Milligan, William, 11.
Ministry, Scene of the, 144-8.
— Duration of, 148 f.
Miracle, 169-84.
Moberly, Robert Campbell, 215.
Moffatt, James, 19.
Moulton, William F., 11.
Muratorian Fragment, 66, 105, 255.
Origen, 66, 238, 255.
Papias, 60, 64, 73, 246, 250 ff., 254;
see De Boor’s Fragment.
Paraclete, 196 f., 219 f.
Passover, 85, 117, 119 f., 151-5;
see Feasts.
Paul, St., 168, 174 f., 188, 261.
— St., and St. John, Relation of, viii, 168, 208-16, 226-33.
Peter, St., and St. John, 91 f., 100, 102, 107.
Peter, Second Epistle of, 43.
Petronius, Satiricon, 35 f.
Pfleiderer, Otto, 26.
Pharisees;
see Sects and Parties.
Philip the Evangelist, 64.
Philo, 55, 185-200.
— De Vita Contemplativa, 54 ff.
Pilgrimages, 117 f.
Polycarp, 60, 62, 242, 256.
Polycrates, 62, 99 f., 102 f., 105.
Pothinus, 61 f.
Pragmatism, 109 ff.
Presbyter, the title, 253.
Presbyters of Clement, 67, 72 f.
— of Papias, 60 f., 63 f., 241.
Purification, 84 f., 120 f.
Quadratus, 250.
Rabbinical Schools, 132.
Ramsay, William M., 112.
Réville, Jean, 2, 28, 31, 200, 256.
Ritschlianism, 47.
Roman Government, 126 ff.
Sadducees;
see Sects and Parties.
Salmon, George, 66.
Samaria, Woman of, 85.
Sanhedrin, 90 f., 100 f., 116, 124 ff.
Schmiedel, Paul W., 2, 26 f., 37 ff., 57, 75, 239 ff., 247, 256.
Schürer, Emil, 18, 28, 55 f.
Schwartz, Eduard, 32, 66, 246.
Sects and Parties, 123 ff.
Silence, Argument from, 33 ff., 39, 171 f., 251.
Soden, Freiherr Hermann von, viii f., 129 f.
Soltau, Wilhelm, 21.
Son of God, the title, 208-26, 231.
Spirit, the Holy, 214 f.
‘spiritual,’ meaning of, 71 f.
Stanton, Vincent H., 3, 37 ff., 241.
Stoics, 199.
Style, Argument from Identity of, 56 f., 74 f., 81.
Supernatural, the, 169-84, 260 f.
Synoptic Gospels, Criticism of, 151 ff., 170-2, 217 f., 261;
see Fourth Gospel, Relation to Synoptics.
Tatian, 66, 238 ff.
Temple, the, 113, 122 f.
Temple, Cleansing of, 149 f.
— Golden Gate of, 113.
— Solomon’s Porch, 123, 164 f.
— Treasury, 123.
Tertullian, 105, 238 ff.
Textual History, Argument from, 55 ff.
‘that year,’ 115.
Thecla, Acts of Paul and, 43, 112.
Theophilus of Antioch, 34, 238.
Tiberias, Sea of, 114.
Tradition, 4, 44.
Trinity, Doctrine of the, 215 f., 218 f., 231.
Valentinus, 247, 256.
Ward, Miss Janet, 1.
Watkins, Henry W., xi.
Weingarten, Hermann, 57.
Weiss, Bernhard, 9 f., 30.
Wellhausen, Julius, ix.
Wendland, Paul, 199.
Wendt, Hans Hinrich, 21 ff., 220 f.
Wernle, Paul, 27, 31, 75, 227-35.
Westcott, Brooke Foss, 13, 93.
Wrede, William, ix, 75, 109 f.
Zahn, Theodor, 8 f., 245.
Footnotes
1. It is this last work that I consider an exception to the high
standard of ability in the group of which I am speaking. It is
absolutely one-sided. I do not doubt the writer’s sincerity, but
he is blissfully unconscious that there is another side to the
argument.
2. Einleitung in d. N. T., 3rd ed., 1897; Das Johannes-Evangelium,
9th ed. (4th of those undertaken by Dr. Weiss), 1892.
3. For Beyschlag’s treatment of the Fourth Gospel see Zur
johanneischen Frage, reprinted from Theol. Studien und
Kritiken (Gotha, 1876); Neutest. Theologie (Halle a. S., 1891),
i. 212-19; Leben Jesu (3rd ed., Halle, 1893).
4. English readers may be reminded that Dr. Ezra Abbot was an
American Unitarian who died in 1884. He was a leading
member of the American Committee which joined in the
production of the Revised Version, and, after serving as
Assistant Librarian, became Professor of New Testament
Criticism in Harvard University in 1872. He was a scholar of
retiring habits, and was one of those who spend in helping and
improving the work of others time that might have been given
to great work of their own. His literary remains were religiously
collected after his death.
5. Probleme d. apost. Zeitalters, p. 92 f.
6. The writings of Dr. Delff that bear upon the subject of the
Fourth Gospel are Die Geschichte d. Rabbi Jesus v. Nazareth
(Leipzig, n. d., but the preface is dated 1889); Das vierte
Evangelium wiederhergestellt (Husum, 1890); Neue Beiträge
zur Kritik und Erklärung des vierten Evangeliums (Husum,
1890).
7. Bousset thinks that this may mean ‘related to’ the high priest
(Offenb. p. 46 n.); but this is questioned by Zahn (Einl. ii. 483).
8. This book is not to be confused with Die urchristlichen
Gemeinden published two years earlier, and now translated
under the title Christian Life in the Primitive Church.
9. Professor Harnack gave a lecture, which I was privileged to
hear, at the Union Seminary on October 10, 1904.
10. Das vierte Evang. p. 12 ff.
11. Enc. Bibl. ii. 2555.
12. New Light, &c., p. 149.
13. A third article, on the internal evidence, appeared in January of
the present year, iii. 353 ff.
14. Urchristentum (ed. 2, Berlin, 1902), ii. 389.
15. Ibid. p. 450.
16. Hibbert Journal, ii. 620.
17. Enc. Bibl. ii. 2554.
18. Beginnings of Christianity, ii. 166 ff.; cf. von Dobschütz,
Probleme, p. 94.
19. Character, &c., p. 157 f.
20. An incidental passage in Dr. Dill’s Roman Society from Nero to
Marcus Aurelius (p. 120 f.) deserves to be set by the side of Dr.
Drummond’s. He is speaking of the Satiricon of Petronius.
‘Those who have attributed it to the friend and victim of Nero
have been confronted with the silence of Quintilian, Juvenal,
and Martial, with the silence of Tacitus as to any literary work
by Petronius, whose character and end he has described with a
curious sympathy and care. It is only late critics of the lower
empire, such as Macrobius, and a dilettante aristocrat like
Sidonius Apollinaris, who pay any attention to this remarkable
work of genius. And Sidonius seems to make its author a
citizen of Marseilles. Yet silence in such cases may be very
deceptive. Martial and Statius never mention one another, and
both might seem unknown to Tacitus. And Tacitus, after the
fashion of the Roman aristocrat, in painting the character of
Petronius, may not have thought it relevant or important to
notice a light work such as the Satiricon, even if he had ever
seen it. He does not think it worth while to mention the
histories of the Emperor Claudius, the tragedies of Seneca, or
the Punica of Silius Italicus.’
21. The two books of Drs. Drummond and Stanton were reviewed
by M. Loisy in the Revue Critique, 1904, pp. 422-4, and Dr.
Drummond’s by Prof. H. J. Holtzmann in Theol.
Literaturzeitung, 1905, cols. 136-9. Both reviews were
disappointing, though Dr. Holtzmann’s contains the usual
amount of painstaking detail. It is natural that play should be
made with the real inconsistencies of Dr. Drummond’s position;
but his weightier arguments are in neither case directly
grappled with.
22. Ignatius, i. 405.
23. See the story in the Moscow MS. of the Martyrium Polycarpi
(Lightfoot, Ignatius, iii. 402), which professes to be taken from
‘the writings of Irenaeus.’
24. Character and Authorship, p. 348.
25. Ibid. p. 213.
26. Chronologie, p. ix.
27. Ibid. p. 678.
28. Chronologie, p. 679.
29. Ibid., p. 680.
30. Chronologie, p. 695.
31. Ueber d. Tod, &c., p. 31.
32. On this phrase see Hort, Judaistic Christianity, pp. 170-3.
33. The division of opinion in this case is among the more radical
critics themselves. H. J. Holtzmann, Schmiedel, and Professor
Bacon are on the one side: Jülicher, Wrede, and Wernle are on
the other; and in each of these instances the opinion is
thoroughly characteristic; the subtle and acute minds are
ranged against those that are stronger on the side of what we
should call plain common sense.
34. Chronologie, &c., p. 676.
35. Letter to the Rev. William Unwin, dated Oct. 31, 1779.
36. Character, &c., p. 387.
37. For the proof see especially Lightfoot.
38. On a Fresh Revision of the New Testament (1871), pp. 72, 73.
39. Texte u. Untersuch. v. 2, p. 170. The other authority is a single
MS. (but the oldest and most interesting) of the ninth-century
writer Georgius Monachus or Georgius Hamartolus (ed. De
Boor, p. 447 [Ἰωάννης] μαρτυρίου κατηξίωται, where the other
MSS. have ἐν εἰρήνη ἀνεπαύσατο). The question of the relation
of the texts is judiciously discussed by De Boor (Preface, pp. lx-
lxxi), but the fuller statement of particulars is reserved for a
third volume.
40. Ueber den Tod der Söhne Zebedaei (Berlin, 1904).
41. Wrede, Charakter und Tendenz d. Johannesevangeliums
(Tübingen and Leipzig, 1903), p. 25.
42. An excellent example is the treatment of the Acts of Paul and
Thecla by Professor W. M. Ramsay in The Church in the Roman
Empire, pp. 375-428.
43. ‘Das Geographische im Evangelium nach Johannes,’ in the
Zeitschr. f. neuttest. Wiss., 1902, pp. 257-265.
44. Cf. Drummond, p. 366 f.; and the writer’s Sacred Sites of the
Gospels, p. 95.
45. H. J. Holtzmann, ad loc., and Einleitung, ed. 2, p. 469: cf.
Drummond, p. 437 f.
46. Pp. 42-6.
47. It is denied by Holtzmann, but approved by Westcott.
48. For a discussion of the nature of this defilement see Chwolson,
Das letzte Passamahl Christi, p. 56 ff.
49. Op. cit. p. 49.
50. It is very surprising that Freiherr Hermann von Soden, in a
pamphlet published at the end of the year, Die wichtigsten
Fragen im Leben Jesu (Berlin, 1904), p. 9, should deny the
existence of local colour in the Fourth Gospel. In proof he
mentions some half-dozen points that occur in the Synoptics
but not in this Gospel; which only means that it is of a different
type from the other three, and does not repeat what was
already found in them. And yet, even of these points, several
come back in another form. It is true that the Gospel does not
describe the healing of a demoniac, but it has many marked
allusions to demoniacal possession (see below, p. 134). It is
true that it has not the name ‘Sadducees’; it speaks of them
rather as ‘chief priests’; but it is well acquainted with their
character and policy (see above, p. 126 ff.). The Gospel has no
‘elders,’ but it has ‘rulers’ or members of the Sanhedrin, whose
position it perfectly understands. In like manner it has no
νομικοί or νομοδιδάσκαλοι, but it is fond of the title ‘Rabbi,’ and
it makes pointed reference to Rabbinical training (see below, p.
132). The whole page of criticism, coming from a writer of
such eminence, is most disappointing. Either the statements
are very questionable as fact or they have not the slightest
bearing on the authorship of the Gospel. Why should not an
Apostle break off somewhat abruptly in his report of a
discourse, or glide imperceptibly from narrative into comment?
That is just what St. Paul does, as we shall see (p. 168,
below).
The truth is that the criticism of the Fourth Gospel on the
liberal side has become largely conventional; one writer after
another repeats certain stereotyped formulae without testing
them. It is high time that they were really tested and
confronted with the facts.
51. On the application of this penalty in the lifetime of Christ, see
above, p. 115.
52. Sanhedr. 97 a.
53. Dial. c. Tryph. §8, cf. 110.
54. Theol. Literaturzeitung, 1893, col. 181 ff.
55. Réville, La doctrine du Logos, p. 67.
56. Grill, p. 218.
57. Ibid., p. 114. Philo’s word for ‘interpreter,’ however, is not
cognate with that used by St. John.
58. Ibid., pp. 115-26.
59. Drummond, Philo Judaeus, ii. 237-9; Grill, pp. 133-6.
60. The main passage is Vit. Mos. iii. 14.
61. That accomplished scholar P. Wendland points to the tendency
to attach the Stoical idea of the λόγος specially to Hermes and
the Egyptian Thoth. He quotes from Cornutus (temp. Nero)
τυγχάνει δὲ ὁ Ἑρμῆς ὁ λόγος ὤν, ὃν ἀπέστειλαν πρὸς ἡμᾶς ἐξ
οὐρανοῦ οἱ θεοί. Hermes is the messenger of the gods, and
communicates their will to men; and it is conceivable that the
use of the term λόγος in connexion with him may have in some
slight degree suggested, or prepared the way for, its use in
connexion with the new revelation. See Christentum u.
Hellenismus (1902), p. 7.
62. Entstehung d. vierten Evang. i. 4-31, 87 ff.
63. Le Quatrième Evangile, p. 98: ‘Les observations précédentes et
tout ce qu’on a remarqué touchant le caractère du quatrième
Evangile prouvent suffisamment que la théologie de
l’incarnation est la clef du livre tout entier, et qu’elle le domine
depuis la première ligne jusqu’à la dernière.’
64. A few sentences here are repeated from my article in Hastings,
D. B. iv. 575.
65. Atonement and Personality, p. 194. Compare the important
and detailed exposition, pp. 154-9, 168 f., 180-2.
66. I do not doubt that the most active period for the putting
together of material for Gospels was the decade 60-70 A.D. At
the beginning of this period St. Mark had not yet taken up his
task; and his Gospel forms the base of the other two
Synoptics. The Matthaean Logia perhaps by this time were
collected.
67. I cannot regard this argument as at all invalidated by Dr.
Drummond’s three sermons, The Pauline Benediction (London,
1897). At the same time I can quite accept the view that the
Apostle’s words are ‘the seed rather than the final expression
of Christian theology.’
68. With the above may be compared Dr. Hort’s comment (ad. loc.)
on 1 St. Peter, i. 1, 2, and other Trinitarian passages referred to
in illustration: ‘In no passage is there any indication that the
writer was independently working out a doctrinal scheme: a
recognized belief or idea seems to be everywhere
presupposed. How such an idea could arise in the mind of St.
Paul or any other apostle without sanction from a Word of the
Lord, it is difficult to imagine: and this consideration is a
sufficient answer to the doubts which have, by no means
unnaturally, been raised whether Matt. xxviii. 19 may not have
been added or recast in a later generation.’
69. Compare the Fifth of the Oxyrhynchus Logia.
70. L’Évangile et L’Église, p. 78 f.
71. H. J. Holtzmann, for instance, points to Is. xiv. 3; xxviii. 12; lv.
1-3; Jer. vi. 16; xxxi. 2, 25, but especially Ecclus. iii. 6; vi. 24,
25, 28, 29; li. 23-30.
72. Contrast the treatment of the passage by M. Loisy with the
way in which it is singled out by Matthew Arnold (Literature
and Dogma, p. 214 f.). Indeed the course of the most recent
criticism has borne in upon me more and more that, far from
being a stumbling-block, it is really the key to any true
understanding of the Christ of the Gospels. If we had not had
the passage, we should have had to invent one like it!
73. I do not of course mean to deny all influence of St. Paul upon
St. John in the shaping or formulating of Christian ideas. But
the ultimate origin of those ideas goes further back than to St.
Paul.
74. See, however, the Oxford Society of Hist. Theol., N. T. in Apost.
Fathers (1905), p. 84.
75. Ibid., pp. 64, 67, 69; on the use of the Fourth Gospel, pp. 81-
83 (a judicious estimate).
76. Ignatius von Antiochien, pp. 46 ff.
77. Strangely enough, the Oxford Society’s committee do not
mention this phrase, though it presents a stronger case than
any of those on p. 31.
78. Hibbert Journal i. 529.
79. Character, &c. 157.
80. Hibbert Journal ii. 610.
81. Chronologie, p. 675.
82. Die Offenbarung Johannis, p. 208.
83. It is pointed out to me by Dr. V. Bartlet that the sentence in the
Fragment about the dead raised to life is really a new
statement not connected with the sentences preceding which
are referred to Papias. I am inclined to think that this is right,
and that the authority may be Quadratus.
84. Since this was written I have had the advantage of seeing in
manuscript an argument by Dom John Chapman, presenting in
a more attractive shape than I have ever yet seen the view
that the only John of Ephesus was the son of Zebedee. All
depends upon the truth of the story of this Apostle’s death. It
is one of those statements that we can neither wholly trust,
nor wholly distrust. There is a real chance that it may be right,
and there is an equally real chance that it may be wrong; the
evidence, as it seems to me, does not warrant a positive
assertion either way. I should be much inclined to think that, if
the statement is true, there was but one John at Ephesus, the
beloved disciple who was also the Presbyter; and, if the
statement is false, there was still but one John, who was both
Presbyter and Apostle. But then there comes in the problem of
the Apocalypse, which may require two Johns!
85. Iren. adv. Haer. iii. 11. 7.
86. Comm. in Joan. i. 6.
Transcriber’s Notes:
Missing or obscured punctuation was silently
corrected.
Typographical errors were silently corrected.
Inconsistent spelling and hyphenation were made
consistent only when a predominant form was
found in this book.
Footnotes have been collected at the end of the
text, and are linked for ease of reference.
*** END OF THE PROJECT GUTENBERG EBOOK THE CRITICISM OF
THE FOURTH GOSPEL ***
Updated editions will replace the previous one—the old editions
will be renamed.
Creating the works from print editions not protected by U.S.
copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.
START: FULL LICENSE
THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK
To protect the Project Gutenberg™ mission of promoting the
free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.
Section 1. General Terms of Use and
Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.
1.B. “Project Gutenberg” is a registered trademark. It may only
be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E. Unless you have removed all references to Project
Gutenberg:
1.E.1. The following sentence, with active links to, or other
immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.
1.E.2. If an individual Project Gutenberg™ electronic work is
derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.
1.E.3. If an individual Project Gutenberg™ electronic work is
posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.
1.E.4. Do not unlink or detach or remove the full Project
Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute
this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
1.E.7. Do not charge a fee for access to, viewing, displaying,
performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.
1.E.8. You may charge a reasonable fee for copies of or
providing access to or distributing Project Gutenberg™
electronic works provided that:
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You provide a full refund of any money paid by a user who
notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.
• You provide, in accordance with paragraph 1.F.3, a full refund of
any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.E.9. If you wish to charge a fee or distribute a Project
Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.
1.F.
1.F.1. Project Gutenberg volunteers and employees expend
considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.
1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except
for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.
1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you
discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.
1.F.4. Except for the limited right of replacement or refund set
forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
1.F.5. Some states do not allow disclaimers of certain implied
warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the
Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.
Section 2. Information about the Mission
of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.
Volunteers and financial support to provide volunteers with the
assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.
Section 3. Information about the Project
Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.
The Foundation’s business office is located at 809 North 1500
West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
PDF
Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edi...
PDF
Complete Download Web Development with Node and Express 2nd Edition Ethan Bro...
PDF
Web Development with Node and Express 2nd Edition Ethan Brown
PDF
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
PDF
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
PDF
Web_Development_with_Node_Express.pdf
PPTX
Building Modern Web Apps with MEAN Stack
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edi...
Complete Download Web Development with Node and Express 2nd Edition Ethan Bro...
Web Development with Node and Express 2nd Edition Ethan Brown
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
Web_Development_with_Node_Express.pdf
Building Modern Web Apps with MEAN Stack

Similar to Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes (20)

PDF
MERN/MEAN Full Stack Developer Course with AI & IoT Integrated
PDF
Exploring MERN Stack and Tech Stacks: A Comparative Analysis
PDF
Download full ebook of Learning Node Shelley Powers instant download pdf
PPTX
Full-Stack-Presentation-Slide(Longsaar_Francis).pptx
ODP
The Full Stack Web Development
PPTX
Welcome TO DreamTech YouTube Channel.pptx
PDF
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
PPTX
MERN stack Workshop - GDG On Campus NBNSCOE
PPTX
fsd2ejhwgufgu ewgwuehguhef heguhgefduhg.pptx
PPT
Node js
PDF
The Guide to becoming a full stack developer in 2018
PDF
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
PDF
Download full ebook of Mean Web Development 2nd Amos Q Haviv instant download...
PDF
Mean Stack Development Full Course
PDF
Tech Thursdays: Building Products
PDF
Learning Nodejs For Net Developers Harry Cummings
PPTX
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
PDF
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
PDF
Backend Development Bootcamp - Node [Online & Offline] In Bangla
PPTX
Web Applications Development with MEAN Stack
MERN/MEAN Full Stack Developer Course with AI & IoT Integrated
Exploring MERN Stack and Tech Stacks: A Comparative Analysis
Download full ebook of Learning Node Shelley Powers instant download pdf
Full-Stack-Presentation-Slide(Longsaar_Francis).pptx
The Full Stack Web Development
Welcome TO DreamTech YouTube Channel.pptx
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
MERN stack Workshop - GDG On Campus NBNSCOE
fsd2ejhwgufgu ewgwuehguhef heguhgefduhg.pptx
Node js
The Guide to becoming a full stack developer in 2018
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Download full ebook of Mean Web Development 2nd Amos Q Haviv instant download...
Mean Stack Development Full Course
Tech Thursdays: Building Products
Learning Nodejs For Net Developers Harry Cummings
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
Backend Development Bootcamp - Node [Online & Offline] In Bangla
Web Applications Development with MEAN Stack
Ad

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Classroom Observation Tools for Teachers
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Pharma ospi slides which help in ospi learning
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
GDM (1) (1).pptx small presentation for students
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Pre independence Education in Inndia.pdf
PDF
Insiders guide to clinical Medicine.pdf
Microbial disease of the cardiovascular and lymphatic systems
Microbial diseases, their pathogenesis and prophylaxis
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Classroom Observation Tools for Teachers
Computing-Curriculum for Schools in Ghana
Pharma ospi slides which help in ospi learning
Supply Chain Operations Speaking Notes -ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Cell Structure & Organelles in detailed.
Anesthesia in Laparoscopic Surgery in India
GDM (1) (1).pptx small presentation for students
STATICS OF THE RIGID BODIES Hibbelers.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
VCE English Exam - Section C Student Revision Booklet
Pre independence Education in Inndia.pdf
Insiders guide to clinical Medicine.pdf
Ad

Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes

  • 1. Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes pdf download https://ebookfinal.com/download/getting-mean-with-mongo-express- angular-and-node-1st-edition-simon-holmes/ Explore and download more ebooks or textbooks at ebookfinal.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit ebookfinal to discover even more! CoffeeScript Programming with jQuery Rails and Node js 1st Edition Michael Erasmus https://ebookfinal.com/download/coffeescript-programming-with-jquery- rails-and-node-js-1st-edition-michael-erasmus/ Web Development with MongoDB and Node 3rd Edition D’Mello https://ebookfinal.com/download/web-development-with-mongodb-and- node-3rd-edition-dmello/ Web Development with Bootstrap 4 and Angular 2 2nd Edition Sergey Akopkokhyants https://ebookfinal.com/download/web-development-with-bootstrap-4-and- angular-2-2nd-edition-sergey-akopkokhyants/ Introducing Elixir Getting Started in Functional Programming 1st Edition Simon St. Laurent https://ebookfinal.com/download/introducing-elixir-getting-started-in- functional-programming-1st-edition-simon-st-laurent/
  • 3. FXRuby Create Lean and Mean GUIs with Ruby Pragmatic Programmers 1st Edition Lyle Johnson https://ebookfinal.com/download/fxruby-create-lean-and-mean-guis-with- ruby-pragmatic-programmers-1st-edition-lyle-johnson/ RESTful Web API Design with Node js Second Edition Bojinov https://ebookfinal.com/download/restful-web-api-design-with-node-js- second-edition-bojinov/ Getting Started with Python and Raspberry Pi 1st Edition Nixon https://ebookfinal.com/download/getting-started-with-python-and- raspberry-pi-1st-edition-nixon/ Web Development with MongoDB and Node Third Edition Bruno D'Mello Joseph Mithun Satheesh https://ebookfinal.com/download/web-development-with-mongodb-and-node- third-edition-bruno-dmello-joseph-mithun-satheesh/ Getting Acquainted with Fractals 1st Edition Gilbert Helmberg https://ebookfinal.com/download/getting-acquainted-with-fractals-1st- edition-gilbert-helmberg/
  • 5. Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes Digital Instant Download Author(s): Simon Holmes ISBN(s): 9781617292033, 1617292036 Edition: 1 File Details: PDF, 16.97 MB Year: 2015 Language: english
  • 6. M A N N I N G Simon Holmes www.it-ebooks.info
  • 7. Getting MEAN Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 8. Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 9. Getting MEAN with Mongo, Express, Angular, and Node SIMON HOLMES M A N N I N G SHELTER ISLAND Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 10. For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com ©2016 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editors: Susie Pitzen, Susanna Kline, 20 Baldwin Road Karen Miller PO Box 761 Technical development editor: Marius Butuc Shelter Island, NY 11964 Copyeditor: Jodie Allen Proofreader: Alyson Brener Technicalproofreaders: Steven Jenkins, Deepak Vohra Typesetter: Dennis Dalinnik Cover designer: Marija Tudor ISBN: 9781617292033 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – EBM – 20 19 18 17 16 15 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 11. v brief contents PART 1 SETTING THE BASELINE .................................................1 1 ■ Introducing full-stack development 3 2 ■ Designing a MEAN stack architecture 24 PART 2 BUILDING A NODE WEB APPLICATION...........................51 3 ■ Creating and setting up a MEAN project 53 4 ■ Building a static site with Node and Express 80 5 ■ Building a data model with MongoDB and Mongoose 120 6 ■ Writing a REST API: Exposing the MongoDB database to the application 160 7 ■ Consuming a REST API: Using an API from inside Express 202 PART 3 ADDING A DYNAMIC FRONT END WITH ANGULAR.........241 8 ■ Adding Angular components to an Express application 243 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 12. BRIEF CONTENTS vi 9 ■ Building a single-page application with Angular: Foundations 276 10 ■ Building an SPA with Angular: The next level 304 PART 4 MANAGING AUTHENTICATION AND USER SESSIONS......347 11 ■ Authenticating users, managing sessions, and securing APIs 349 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 13. vii contents preface xv acknowledgments xvii about this book xix PART 1 SETTING THE BASELINE......................................1 1 Introducing full-stack development 3 1.1 Why learn the full stack? 4 A very brief history of web development 4 ■ The trend toward full-stack developers 6 ■ Benefits of full-stack development 6 Why the MEAN stack specifically? 7 1.2 Introducing Node.js: The web server/platform 7 JavaScript: The single language through the stack 8 Fast, efficient, and scalable 8 ■ Using prebuilt packages via npm 11 1.3 Introducing Express: The framework 12 Easing your server setup 12 ■ Routing URLs to responses 12 Views: HTML responses 12 ■ Remembering visitors with session support 13 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 14. CONTENTS viii 1.4 Introducing MongoDB: The database 13 Relational versus document databases 13 ■ MongoDB documents: JavaScript data store 14 ■ More than just a document database 14 ■ What is MongoDB not good for? 15 ■ Mongoose for data modeling and more 15 1.5 Introducing AngularJS: The front-end framework 16 jQuery versus AngularJS 16 ■ Two-way data binding: Working with data in a page 16 ■ Using AngularJS to load new pages 18 Are there any downsides? 18 1.6 Supporting cast 19 Twitter Bootstrap for user interface 19 ■ Git for source control 20 Hosting with Heroku 20 1.7 Putting it together with a practical example 21 Introducing the example application 21 ■ How the MEAN stack components work together 22 1.8 Summary 23 2 Designing a MEAN stack architecture 24 2.1 A common MEAN stack architecture 25 2.2 Looking beyond SPAs 26 Hard to crawl 26 ■ Analytics and browser history 27 Speed of initial load 27 ■ To SPA or not to SPA? 28 2.3 Designing a flexible MEAN architecture 28 Requirements for a blog engine 29 ■ A blog engine architecture 30 ■ Best practice: Build an internal API for a data layer 33 2.4 Planning a real application 34 Planning the application at a high level 35 ■ Architecting the application 36 ■ Wrapping everything in an Express project 38 The end product 39 2.5 Breaking the development into stages 40 Rapid prototype development stages 40 ■ The steps to build Loc8r 41 2.6 Hardware architecture 47 Development hardware 47 ■ Production hardware 47 2.7 Summary 49 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 15. CONTENTS ix PART 2 BUILDING A NODE WEB APPLICATION ...............51 3 Creating and setting up a MEAN project 53 3.1 A brief look at Express, Node, and npm 55 Defining packages with package.json 55 ■ Installing Node dependencies with npm 56 3.2 Creating an Express project 58 Installing the pieces 58 ■ Creating a project folder 58 Configuring an Express installation 59 ■ Creating an Express project and trying it out 61 ■ Restarting the application 62 3.3 Modifying Express for MVC 64 A bird’s eye view of MVC 64 ■ Changing the folder structure 65 Using the new views and routes folders 66 ■ Splitting controllers from routes 67 3.4 Import Bootstrap for quick, responsive layouts 70 Download Bootstrap and add it to the application 70 Using Bootstrap in the application 70 3.5 Make it live on Heroku 74 Getting Heroku set up 74 ■ Pushing the site live using Git 76 3.6 Summary 79 4 Building a static site with Node and Express 80 4.1 Defining the routes in Express 82 Different controller files for different collections 83 4.2 Building basic controllers 84 Setting up controllers 85 ■ Testing the controllers and routes 86 4.3 Creating some views 87 A look at Bootstrap 88 ■ Setting up the HTML framework with Jade templates and Bootstrap 89 ■ Building a template 93 4.4 Adding the rest of the views 98 Details page 98 ■ Adding Review page 102 The About page 104 4.5 Take the data out of the views and make them smarter 106 How to move data from the view to the controller 107 Dealing with complex, repeating data 109 ■ Manipulating the data and view with code 113 ■ Using includes and mixins to Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 16. CONTENTS x create reusable layout components 113 ■ The finished homepage 115 ■ Updating the rest of the views and controllers 117 4.6 Summary 119 5 Building a data model with MongoDB and Mongoose 120 5.1 Connecting the Express application to MongoDB using Mongoose 122 Adding Mongoose to our application 123 ■ Adding a Mongoose connection to our application 124 5.2 Why model the data? 130 What is Mongoose and how does it work? 131 5.3 Defining simple Mongoose schemas 134 The basics of setting up a schema 135 ■ Using geographic data in MongoDB and Mongoose 137 ■ Creating more complex schemas with subdocuments 138 ■ Final schema 143 Compiling Mongoose schemas into models 145 5.4 Using the MongoDB shell to create a MongoDB database and add data 147 MongoDB shell basics 147 ■ Creating a MongoDB database 148 5.5 Getting our database live 152 Setting up MongoLab and getting the database URI 152 Pushing up the data 154 ■ Making the application use the right database 156 5.6 Summary 159 6 Writing a REST API: Exposing the MongoDB database to the application 160 6.1 The rules of a REST API 161 Request URLs 162 ■ Request methods 163 ■ Responses and status codes 165 6.2 Setting up the API in Express 167 Creating the routes 167 ■ Creating the controller placeholders 170 ■ Including the model 171 Testing the API 172 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 17. CONTENTS xi 6.3 GET methods: Reading data from MongoDB 172 Finding a single document in MongoDB using Mongoose 173 Finding a single subdocument based on IDs 177 Finding multiple documents with geospatial queries 180 6.4 POST methods: Adding data to MongoDB 187 Creating new documents in MongoDB 188 ■ Creating new subdocuments in MongoDB 190 6.5 PUT methods: Updating data in MongoDB 193 Using Mongoose to update a document in MongoDB 194 Updating an existing subdocument in MongoDB 196 6.6 DELETE method: Deleting data from MongoDB 197 Deleting documents in MongoDB 198 ■ Deleting a subdocument from MongoDB 199 6.7 Summary 200 7 Consuming a REST API: Using an API from inside Express 202 7.1 How to call an API from Express 203 Adding the request module to our project 203 ■ Setting up default options 204 ■ Using the request module 204 7.2 Using lists of data from an API: The Loc8r homepage 206 Separating concerns: Moving the rendering into a named function 207 ■ Building the API request 207 Using the API response data 208 ■ Modifying data before displaying it: Fixing the distances 209 ■ Catching errors returned by the API 212 7.3 Getting single documents from an API: The Loc8r Details page 216 Setting URLs and routes to access specific MongoDB documents 216 ■ Separating concerns: Moving the rendering into a named function 218 ■ Querying the API using a unique ID from a URL parameter 219 ■ Passing the data from the API to the view 220 ■ Debugging and fixing the view errors 221 Creating status-specific error pages 223 7.4 Adding data to the database via the API: Add Loc8r reviews 226 Setting up the routing and views 227 ■ POSTing the review data to the API 231 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 18. CONTENTS xii 7.5 Protecting data integrity with data validation 233 Validating at the schema level with Mongoose 234 ■ Validating at the application level with Node and Express 237 ■ Validating in the browser with jQuery 239 7.6 Summary 240 PART 3 ADDING A DYNAMIC FRONT END WITH ANGULAR .............................................241 8 Adding Angular components to an Express application 243 8.1 Getting Angular up and running 244 Uncovering two-way data binding 245 ■ Setting up for greatness (and JavaScript code) 248 8.2 Displaying and filtering the homepage list 251 Adding Angular to an Express application 251 ■ Moving data delivery from Express to Angular 252 ■ Using Angular filters to format data 255 ■ Using Angular directives to create HTML snippets 259 8.3 Getting data from an API 263 Using services for data 264 ■ Making HTTP requests from Angular to an API 265 ■ Adding HTML geolocation to find places near you 268 8.4 Ensuring forms work as expected 274 8.5 Summary 275 9 Building a single-page application with Angular: Foundations 276 9.1 Setting the groundwork for an Angular SPA 277 Getting base files in place 278 9.2 Switching from Express routing to Angular routing 279 Switching off the Express routing 279 ■ Adding ngRoute (angular-route) to the application 282 9.3 Adding the first views, controllers, and services 284 Creating an Angular view 284 ■ Adding a controller to a route 286 ■ Controller best practice: Using the controllerAs syntax 288 ■ Using services 291 Using filters and directives 294 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 19. CONTENTS xiii 9.4 Improving browser performance 297 Wrap each file in an IIFE 298 ■ Manually injecting dependencies to protect against minification 299 ■ Using UglifyJS to minify and concatenate scripts 300 9.5 Summary 303 10 Building an SPA with Angular: The next level 304 10.1 A full SPA: Removing reliance on the server-side application 305 Creating an isolated HTML host page 305 Making reusable page framework directives 307 Removing the # from URLs 312 10.2 Adding additional pages and dynamically injecting HTML 314 Adding a new route and page to the SPA 315 Creating a filter to transform the line breaks 317 Sending HTML through an Angular binding 319 10.3 More complex views and routing parameters 321 Getting the page framework in place 321 ■ Using URL parameters in controllers and services 323 ■ Building the Details page view 326 10.4 Using AngularUI components to create a modal popup 330 Getting AngularUI in place 330 ■ Adding and using a click handler 332 ■ Creating a Bootstrap modal with AngularUI 333 Passing data into the modal 335 ■ Using the form to submit a review 337 10.5 Summary 345 PART 4 MANAGING AUTHENTICATION AND USER SESSIONS...............................................347 11 Authenticating users, managing sessions, and securing APIs 349 11.1 How to approach authentication in the MEAN stack 350 Traditional server-based application approach 350 ■ Full MEAN stack approach 352 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 20. CONTENTS xiv 11.2 Creating a user schema for MongoDB 354 One-way password encryption: Hashes and salts 354 ■ Building the Mongoose schema 354 ■ Setting encrypted paths using Mongoose methods 355 ■ Validating a submitted password 357 Generating a JSON Web Token 357 11.3 Creating an authentication API with Passport 360 Installing and configuring Passport 360 ■ Creating API endpoints to return JSON Web Tokens 363 11.4 Securing relevant API endpoints 368 Adding authentication middleware to Express routes 368 Using the JWT information inside a controller 369 11.5 Creating Angular authentication service 373 Managing a user session in Angular 373 ■ Allowing users to sign up, sign in, and sign out 374 ■ Using the JWT data in the Angular service 375 11.6 Creating register and login pages 377 Building the register page 377 ■ Building the login page 380 11.7 Working with authentication in the Angular app 383 Updating navigation 383 ■ Adding user data to a review 386 11.8 Summary 389 appendix A Installing the stack 391 appendix B Installing and preparing the supporting cast 395 appendix C Dealing with all of the views 399 appendix D Reintroducing JavaScript available online only index 405 Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 21. xv preface Back in 1995 I got my first taste of web development, putting together a few pages of simple HTML for a piece of university coursework. It was a small part of my course, which was a mixture of software engineering and communication studies. This was an unusual mixture. I learned the fundamentals of software development, database design, and programming. But I also learned about the importance of the audience and end- user and how to communicate with them, both verbally and non-verbally. In 1998, on the communication studies side of the degree, I was required to write a publication for an organization of my choice. I decided to write a prospectus for the school where my mother was teaching at the time. But I decided to do it as a website. Again this was all front-end work. Fortunately I no longer have a copy of it, as I shudder at the thought of the code. We’re talking HTML with frames, table layouts, inline styles, and a smattering of basic JavaScript. By today’s standards it was shocking, but back then it was quite futuristic. I was the first person at the university to submit a website as a pub- lication. I even had to tell my instructors how to open it in their browser from the floppy disk it was submitted on! After it was completed and marked, I sold the website to the school it was about. I figured there was probably a future in this web development thing. During the following years I made use of both parts of my degree working as the “web guy” in a London design agency. Because it was a design agency, user-experience (before it was called UX) and the front end were crucial. But of course there has to be a back end to support the front end. As the only web guy I fulfilled both roles as the classic full- stack developer. There wasn’t much separation of concerns in those days. The database was tightly coupled to the back end. Back-end logic, markup, and front-end logic all Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 22. PREFACE xvi wove together tightly. This is largely because the project was thought of as a single thing: the website. Many of the best practices from this book are borne of the pain of finding out the hard way over these years. Something that might seem harmless at the time, most def- initely easier, or sometimes even sensible, can come back to bite you later on. Don’t let this put you off from diving in and having a go. Mistakes are there to be made, and— in this arena at least—mistakes are a great way of learning. They say that intelligence is “learning from your mistakes.” This is true, but you’ll be a step ahead if you can also learn from others’ mistakes. The web development landscape changed over the years, but I was still heavily involved with creating—or managing the creation of—full websites and applications. I came to appreciate that there is a real art to gluing together applications made from different technologies. It is a skill in itself; just knowing the technologies and what they can do is only part of the challenge. When Node.js came onto my radar I jumped right in and embraced the idea full on. I had done a lot of context switching between various languages, and the idea of having a single language to focus on and master was extremely compelling. I figured that if used in the right way it could streamline development by reducing the language context shifting. Playing with Node I started to create my own MVC framework, before discovering Express. Express solved a lot of the problems and challenges I faced when first trying to learn Node and use it to create a website or web application. In many ways adopting it was a no-brainer. Naturally, behind pretty much any web application is a database. I didn’t want to fall back on my previous go-to option of Microsoft SQL Server, as the cost made it quite prohibitive to launch small personal projects. Some research led me to the lead- ing open source NoSQL database: MongoDB. It worked natively with JavaScript! I was more excited than I possibly should have been about a database. However MongoDB was different from all of the databases I had used before. My previous experience was all in relational databases; MongoDB is a document database, and that is something quite different, making the way you approach database design quite different as well. I had to retrain my brain to think in this new way, and eventually it all made sense. There was just one piece missing. JavaScript in the browser was no longer just about enhancing functionality, it was about creating the functionality and managing the application logic. Out of the available options I was already leaning toward AngularJS. When I heard Valeri Karpov of MongoDB coin the term “MEAN stack” that was it. I knew that here was a next-generation stack. I knew that the MEAN stack would be powerful. I knew that the MEAN stack would be flexible. I knew that the MEAN stack would capture the imagination of developers. Each of the individual technologies is great, but when you put them all together you have something exceptional on your hands. This is where Getting MEAN comes from. Getting the best out of the MEAN stack is more than just knowing the technologies, it’s about knowing how to get those technologies working together. Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 23. xvii acknowledgments I must start with the people who mean the world to me, who inspire me to push myself, and who ultimately make everything worthwhile. I’m talking about my wife, Sally, and daughters, Eri and Bel. Everything I do starts and ends with these three ladies. Thanks of course must go to the Manning team. I know it extends beyond the peo- ple I’m about to name, so if you were involved in any way then thank you! Here are the people I have personally dealt with. Right from the beginning there was Robin de Jongh who was instrumental in get- ting the project started and also in shaping the book. And many thanks to Bert Bates for providing great insight and challenging me to justify my thinking and opinions from an early stage. Those were fun conversations. Crucial to the momentum and feel of the book were my developmental editors, Susie Pitzen, Susanna Kline, and Karen Miller. And of course my technical developmen- tal editor, Marius Butuc. Thanks all for sharp eyes, great ideas, and positive feedback. The next two people really impressed me with their amount of effort and attention to detail. So thank you Kevin Sullivan and Jodie Allen for the copyediting and proof- ing, and for staying on top of everything under increasingly short timeframes. Last but by no means least for the Manning team is Candace Gillhoolley, who has been keeping up the marketing pace on the book, giving me the sales numbers to maintain my motivation. Manning must also be congratulated for having their Manning Early Access Pro- gram (MEAP) and associated online author forum. The comments, corrections, ideas, and feedback from early readers proved invaluable in improving the quality of this Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 24. ACKNOWLEDGMENTS xviii book. I don’t have the names of everybody who contributed. You know who you are: thank you! Special thanks for their insights and suggestions to the following peer reviewers who read the manuscript at various stages of its development: Andrea Tarocchi, Andy Knight, Blake Hall, Cynthia Pepper, Davide Molin, Denis Ndwiga, Devang Paliwal, Douglas Duncan, Filip Pravica, Filippo Veneri, Francesco Bianchi, Jesus Rodriguez Rodriguez, Matt Merkes, Rambabu Posa, and William E. Wheeler. Also to Steven Jenkins and Deepak Vohra for their final technical proofread of the chapters, shortly before they went into production. A couple of extra shout-outs for putting up with me and my late-night technology discussions are to Tamas Piros and Marek Karwowski. Thanks guys! Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 25. xix about this book JavaScript has come of age. Building an entire web application from front to back with just one language is now possible, using JavaScript. The MEAN stack is comprised of the best-of-breed technologies in this arena. You’ve got MongoDB for the database, Express for the server-side web-application framework, AngularJS for the client-side framework, and Node for the server-side platform. This book introduces each of these technologies, as well as how to get them work- ing well together as a stack. Throughout the book we build a working application, focusing on one technology at a time, seeing how they fit into the overall application architecture. So it’s a very practical book designed to get you comfortable with all of the technologies and how to use them together. A common theme running through the book is “best practice.” This book is a springboard to building great things with the MEAN stack, so there is a focus on creat- ing good habits, doing things the “right way,” and planning ahead. This book doesn’t teach HTML, CSS, or basic JavaScript; previous knowledge of these are assumed. It does include a very brief primer on the Twitter Bootstrap CSS frame- work, and there’s also a good, long appendix on JavaScript theory, best practice, tips, and gotchas. It’s worth checking out early on. This appendix can be found online at www.manning.com/books/getting-mean-with-mongo-express-angular-and-node. Roadmap This book takes you on a journey through eleven chapters, as follows: Chapter 1 takes a look at the benefits of learning full-stack development and explores the components of the MEAN stack. Licensed to Mark Watson <nordickan@gmail.com> www.it-ebooks.info
  • 26. Discovering Diverse Content Through Random Scribd Documents
  • 27. Keim, Theodor, 241. Kreyenbuhl, Johannes, xi. Last Discourse, 90, 94 ff. Last Supper, 88 f., 94, 150-5. Lazarus, Story of, 87 f., 170-2. Light and Life, 190 f., 201. Lightfoot, Joseph B., 12, 51 ff. Local Colour, 129-36. Logos, Doctrine of the, 185-204, 211 ff. Loisy, Abbé Alfred, 2, 28, 31, 41, 200-4, 205, 223 f., 256. Lucius, Ernst, 54 f. Luthardt, Christoph E., 11. Malchus, 90. Matthew, Apocryphal Gospel of, 112 f. McGiffert, A. Cushman, 19. Memra, 187. Messiah, the title, 208, 221 f. Messianic Expectation, 117, 136-40, 158 f. Milligan, William, 11. Ministry, Scene of the, 144-8. — Duration of, 148 f. Miracle, 169-84. Moberly, Robert Campbell, 215.
  • 28. Moffatt, James, 19. Moulton, William F., 11. Muratorian Fragment, 66, 105, 255. Origen, 66, 238, 255. Papias, 60, 64, 73, 246, 250 ff., 254; see De Boor’s Fragment. Paraclete, 196 f., 219 f. Passover, 85, 117, 119 f., 151-5; see Feasts. Paul, St., 168, 174 f., 188, 261. — St., and St. John, Relation of, viii, 168, 208-16, 226-33. Peter, St., and St. John, 91 f., 100, 102, 107. Peter, Second Epistle of, 43. Petronius, Satiricon, 35 f. Pfleiderer, Otto, 26. Pharisees; see Sects and Parties. Philip the Evangelist, 64. Philo, 55, 185-200. — De Vita Contemplativa, 54 ff. Pilgrimages, 117 f. Polycarp, 60, 62, 242, 256. Polycrates, 62, 99 f., 102 f., 105. Pothinus, 61 f.
  • 29. Pragmatism, 109 ff. Presbyter, the title, 253. Presbyters of Clement, 67, 72 f. — of Papias, 60 f., 63 f., 241. Purification, 84 f., 120 f. Quadratus, 250. Rabbinical Schools, 132. Ramsay, William M., 112. Réville, Jean, 2, 28, 31, 200, 256. Ritschlianism, 47. Roman Government, 126 ff. Sadducees; see Sects and Parties. Salmon, George, 66. Samaria, Woman of, 85. Sanhedrin, 90 f., 100 f., 116, 124 ff. Schmiedel, Paul W., 2, 26 f., 37 ff., 57, 75, 239 ff., 247, 256. Schürer, Emil, 18, 28, 55 f. Schwartz, Eduard, 32, 66, 246. Sects and Parties, 123 ff. Silence, Argument from, 33 ff., 39, 171 f., 251. Soden, Freiherr Hermann von, viii f., 129 f. Soltau, Wilhelm, 21.
  • 30. Son of God, the title, 208-26, 231. Spirit, the Holy, 214 f. ‘spiritual,’ meaning of, 71 f. Stanton, Vincent H., 3, 37 ff., 241. Stoics, 199. Style, Argument from Identity of, 56 f., 74 f., 81. Supernatural, the, 169-84, 260 f. Synoptic Gospels, Criticism of, 151 ff., 170-2, 217 f., 261; see Fourth Gospel, Relation to Synoptics. Tatian, 66, 238 ff. Temple, the, 113, 122 f. Temple, Cleansing of, 149 f. — Golden Gate of, 113. — Solomon’s Porch, 123, 164 f. — Treasury, 123. Tertullian, 105, 238 ff. Textual History, Argument from, 55 ff. ‘that year,’ 115. Thecla, Acts of Paul and, 43, 112. Theophilus of Antioch, 34, 238. Tiberias, Sea of, 114. Tradition, 4, 44. Trinity, Doctrine of the, 215 f., 218 f., 231. Valentinus, 247, 256.
  • 31. Ward, Miss Janet, 1. Watkins, Henry W., xi. Weingarten, Hermann, 57. Weiss, Bernhard, 9 f., 30. Wellhausen, Julius, ix. Wendland, Paul, 199. Wendt, Hans Hinrich, 21 ff., 220 f. Wernle, Paul, 27, 31, 75, 227-35. Westcott, Brooke Foss, 13, 93. Wrede, William, ix, 75, 109 f. Zahn, Theodor, 8 f., 245. Footnotes 1. It is this last work that I consider an exception to the high standard of ability in the group of which I am speaking. It is absolutely one-sided. I do not doubt the writer’s sincerity, but he is blissfully unconscious that there is another side to the argument. 2. Einleitung in d. N. T., 3rd ed., 1897; Das Johannes-Evangelium, 9th ed. (4th of those undertaken by Dr. Weiss), 1892. 3. For Beyschlag’s treatment of the Fourth Gospel see Zur johanneischen Frage, reprinted from Theol. Studien und Kritiken (Gotha, 1876); Neutest. Theologie (Halle a. S., 1891), i. 212-19; Leben Jesu (3rd ed., Halle, 1893).
  • 32. 4. English readers may be reminded that Dr. Ezra Abbot was an American Unitarian who died in 1884. He was a leading member of the American Committee which joined in the production of the Revised Version, and, after serving as Assistant Librarian, became Professor of New Testament Criticism in Harvard University in 1872. He was a scholar of retiring habits, and was one of those who spend in helping and improving the work of others time that might have been given to great work of their own. His literary remains were religiously collected after his death. 5. Probleme d. apost. Zeitalters, p. 92 f. 6. The writings of Dr. Delff that bear upon the subject of the Fourth Gospel are Die Geschichte d. Rabbi Jesus v. Nazareth (Leipzig, n. d., but the preface is dated 1889); Das vierte Evangelium wiederhergestellt (Husum, 1890); Neue Beiträge zur Kritik und Erklärung des vierten Evangeliums (Husum, 1890). 7. Bousset thinks that this may mean ‘related to’ the high priest (Offenb. p. 46 n.); but this is questioned by Zahn (Einl. ii. 483). 8. This book is not to be confused with Die urchristlichen Gemeinden published two years earlier, and now translated under the title Christian Life in the Primitive Church. 9. Professor Harnack gave a lecture, which I was privileged to hear, at the Union Seminary on October 10, 1904. 10. Das vierte Evang. p. 12 ff. 11. Enc. Bibl. ii. 2555. 12. New Light, &c., p. 149.
  • 33. 13. A third article, on the internal evidence, appeared in January of the present year, iii. 353 ff. 14. Urchristentum (ed. 2, Berlin, 1902), ii. 389. 15. Ibid. p. 450. 16. Hibbert Journal, ii. 620. 17. Enc. Bibl. ii. 2554. 18. Beginnings of Christianity, ii. 166 ff.; cf. von Dobschütz, Probleme, p. 94. 19. Character, &c., p. 157 f. 20. An incidental passage in Dr. Dill’s Roman Society from Nero to Marcus Aurelius (p. 120 f.) deserves to be set by the side of Dr. Drummond’s. He is speaking of the Satiricon of Petronius. ‘Those who have attributed it to the friend and victim of Nero have been confronted with the silence of Quintilian, Juvenal, and Martial, with the silence of Tacitus as to any literary work by Petronius, whose character and end he has described with a curious sympathy and care. It is only late critics of the lower empire, such as Macrobius, and a dilettante aristocrat like Sidonius Apollinaris, who pay any attention to this remarkable work of genius. And Sidonius seems to make its author a citizen of Marseilles. Yet silence in such cases may be very deceptive. Martial and Statius never mention one another, and both might seem unknown to Tacitus. And Tacitus, after the fashion of the Roman aristocrat, in painting the character of Petronius, may not have thought it relevant or important to notice a light work such as the Satiricon, even if he had ever seen it. He does not think it worth while to mention the histories of the Emperor Claudius, the tragedies of Seneca, or the Punica of Silius Italicus.’
  • 34. 21. The two books of Drs. Drummond and Stanton were reviewed by M. Loisy in the Revue Critique, 1904, pp. 422-4, and Dr. Drummond’s by Prof. H. J. Holtzmann in Theol. Literaturzeitung, 1905, cols. 136-9. Both reviews were disappointing, though Dr. Holtzmann’s contains the usual amount of painstaking detail. It is natural that play should be made with the real inconsistencies of Dr. Drummond’s position; but his weightier arguments are in neither case directly grappled with. 22. Ignatius, i. 405. 23. See the story in the Moscow MS. of the Martyrium Polycarpi (Lightfoot, Ignatius, iii. 402), which professes to be taken from ‘the writings of Irenaeus.’ 24. Character and Authorship, p. 348. 25. Ibid. p. 213. 26. Chronologie, p. ix. 27. Ibid. p. 678. 28. Chronologie, p. 679. 29. Ibid., p. 680. 30. Chronologie, p. 695. 31. Ueber d. Tod, &c., p. 31. 32. On this phrase see Hort, Judaistic Christianity, pp. 170-3. 33. The division of opinion in this case is among the more radical critics themselves. H. J. Holtzmann, Schmiedel, and Professor Bacon are on the one side: Jülicher, Wrede, and Wernle are on the other; and in each of these instances the opinion is
  • 35. thoroughly characteristic; the subtle and acute minds are ranged against those that are stronger on the side of what we should call plain common sense. 34. Chronologie, &c., p. 676. 35. Letter to the Rev. William Unwin, dated Oct. 31, 1779. 36. Character, &c., p. 387. 37. For the proof see especially Lightfoot. 38. On a Fresh Revision of the New Testament (1871), pp. 72, 73. 39. Texte u. Untersuch. v. 2, p. 170. The other authority is a single MS. (but the oldest and most interesting) of the ninth-century writer Georgius Monachus or Georgius Hamartolus (ed. De Boor, p. 447 [Ἰωάννης] μαρτυρίου κατηξίωται, where the other MSS. have ἐν εἰρήνη ἀνεπαύσατο). The question of the relation of the texts is judiciously discussed by De Boor (Preface, pp. lx- lxxi), but the fuller statement of particulars is reserved for a third volume. 40. Ueber den Tod der Söhne Zebedaei (Berlin, 1904). 41. Wrede, Charakter und Tendenz d. Johannesevangeliums (Tübingen and Leipzig, 1903), p. 25. 42. An excellent example is the treatment of the Acts of Paul and Thecla by Professor W. M. Ramsay in The Church in the Roman Empire, pp. 375-428. 43. ‘Das Geographische im Evangelium nach Johannes,’ in the Zeitschr. f. neuttest. Wiss., 1902, pp. 257-265. 44. Cf. Drummond, p. 366 f.; and the writer’s Sacred Sites of the Gospels, p. 95.
  • 36. 45. H. J. Holtzmann, ad loc., and Einleitung, ed. 2, p. 469: cf. Drummond, p. 437 f. 46. Pp. 42-6. 47. It is denied by Holtzmann, but approved by Westcott. 48. For a discussion of the nature of this defilement see Chwolson, Das letzte Passamahl Christi, p. 56 ff. 49. Op. cit. p. 49. 50. It is very surprising that Freiherr Hermann von Soden, in a pamphlet published at the end of the year, Die wichtigsten Fragen im Leben Jesu (Berlin, 1904), p. 9, should deny the existence of local colour in the Fourth Gospel. In proof he mentions some half-dozen points that occur in the Synoptics but not in this Gospel; which only means that it is of a different type from the other three, and does not repeat what was already found in them. And yet, even of these points, several come back in another form. It is true that the Gospel does not describe the healing of a demoniac, but it has many marked allusions to demoniacal possession (see below, p. 134). It is true that it has not the name ‘Sadducees’; it speaks of them rather as ‘chief priests’; but it is well acquainted with their character and policy (see above, p. 126 ff.). The Gospel has no ‘elders,’ but it has ‘rulers’ or members of the Sanhedrin, whose position it perfectly understands. In like manner it has no νομικοί or νομοδιδάσκαλοι, but it is fond of the title ‘Rabbi,’ and it makes pointed reference to Rabbinical training (see below, p. 132). The whole page of criticism, coming from a writer of such eminence, is most disappointing. Either the statements are very questionable as fact or they have not the slightest bearing on the authorship of the Gospel. Why should not an Apostle break off somewhat abruptly in his report of a discourse, or glide imperceptibly from narrative into comment?
  • 37. That is just what St. Paul does, as we shall see (p. 168, below). The truth is that the criticism of the Fourth Gospel on the liberal side has become largely conventional; one writer after another repeats certain stereotyped formulae without testing them. It is high time that they were really tested and confronted with the facts. 51. On the application of this penalty in the lifetime of Christ, see above, p. 115. 52. Sanhedr. 97 a. 53. Dial. c. Tryph. §8, cf. 110. 54. Theol. Literaturzeitung, 1893, col. 181 ff. 55. Réville, La doctrine du Logos, p. 67. 56. Grill, p. 218. 57. Ibid., p. 114. Philo’s word for ‘interpreter,’ however, is not cognate with that used by St. John. 58. Ibid., pp. 115-26. 59. Drummond, Philo Judaeus, ii. 237-9; Grill, pp. 133-6. 60. The main passage is Vit. Mos. iii. 14. 61. That accomplished scholar P. Wendland points to the tendency to attach the Stoical idea of the λόγος specially to Hermes and the Egyptian Thoth. He quotes from Cornutus (temp. Nero) τυγχάνει δὲ ὁ Ἑρμῆς ὁ λόγος ὤν, ὃν ἀπέστειλαν πρὸς ἡμᾶς ἐξ οὐρανοῦ οἱ θεοί. Hermes is the messenger of the gods, and communicates their will to men; and it is conceivable that the use of the term λόγος in connexion with him may have in some
  • 38. slight degree suggested, or prepared the way for, its use in connexion with the new revelation. See Christentum u. Hellenismus (1902), p. 7. 62. Entstehung d. vierten Evang. i. 4-31, 87 ff. 63. Le Quatrième Evangile, p. 98: ‘Les observations précédentes et tout ce qu’on a remarqué touchant le caractère du quatrième Evangile prouvent suffisamment que la théologie de l’incarnation est la clef du livre tout entier, et qu’elle le domine depuis la première ligne jusqu’à la dernière.’ 64. A few sentences here are repeated from my article in Hastings, D. B. iv. 575. 65. Atonement and Personality, p. 194. Compare the important and detailed exposition, pp. 154-9, 168 f., 180-2. 66. I do not doubt that the most active period for the putting together of material for Gospels was the decade 60-70 A.D. At the beginning of this period St. Mark had not yet taken up his task; and his Gospel forms the base of the other two Synoptics. The Matthaean Logia perhaps by this time were collected. 67. I cannot regard this argument as at all invalidated by Dr. Drummond’s three sermons, The Pauline Benediction (London, 1897). At the same time I can quite accept the view that the Apostle’s words are ‘the seed rather than the final expression of Christian theology.’ 68. With the above may be compared Dr. Hort’s comment (ad. loc.) on 1 St. Peter, i. 1, 2, and other Trinitarian passages referred to in illustration: ‘In no passage is there any indication that the writer was independently working out a doctrinal scheme: a recognized belief or idea seems to be everywhere presupposed. How such an idea could arise in the mind of St.
  • 39. Paul or any other apostle without sanction from a Word of the Lord, it is difficult to imagine: and this consideration is a sufficient answer to the doubts which have, by no means unnaturally, been raised whether Matt. xxviii. 19 may not have been added or recast in a later generation.’ 69. Compare the Fifth of the Oxyrhynchus Logia. 70. L’Évangile et L’Église, p. 78 f. 71. H. J. Holtzmann, for instance, points to Is. xiv. 3; xxviii. 12; lv. 1-3; Jer. vi. 16; xxxi. 2, 25, but especially Ecclus. iii. 6; vi. 24, 25, 28, 29; li. 23-30. 72. Contrast the treatment of the passage by M. Loisy with the way in which it is singled out by Matthew Arnold (Literature and Dogma, p. 214 f.). Indeed the course of the most recent criticism has borne in upon me more and more that, far from being a stumbling-block, it is really the key to any true understanding of the Christ of the Gospels. If we had not had the passage, we should have had to invent one like it! 73. I do not of course mean to deny all influence of St. Paul upon St. John in the shaping or formulating of Christian ideas. But the ultimate origin of those ideas goes further back than to St. Paul. 74. See, however, the Oxford Society of Hist. Theol., N. T. in Apost. Fathers (1905), p. 84. 75. Ibid., pp. 64, 67, 69; on the use of the Fourth Gospel, pp. 81- 83 (a judicious estimate). 76. Ignatius von Antiochien, pp. 46 ff. 77. Strangely enough, the Oxford Society’s committee do not mention this phrase, though it presents a stronger case than
  • 40. any of those on p. 31. 78. Hibbert Journal i. 529. 79. Character, &c. 157. 80. Hibbert Journal ii. 610. 81. Chronologie, p. 675. 82. Die Offenbarung Johannis, p. 208. 83. It is pointed out to me by Dr. V. Bartlet that the sentence in the Fragment about the dead raised to life is really a new statement not connected with the sentences preceding which are referred to Papias. I am inclined to think that this is right, and that the authority may be Quadratus. 84. Since this was written I have had the advantage of seeing in manuscript an argument by Dom John Chapman, presenting in a more attractive shape than I have ever yet seen the view that the only John of Ephesus was the son of Zebedee. All depends upon the truth of the story of this Apostle’s death. It is one of those statements that we can neither wholly trust, nor wholly distrust. There is a real chance that it may be right, and there is an equally real chance that it may be wrong; the evidence, as it seems to me, does not warrant a positive assertion either way. I should be much inclined to think that, if the statement is true, there was but one John at Ephesus, the beloved disciple who was also the Presbyter; and, if the statement is false, there was still but one John, who was both Presbyter and Apostle. But then there comes in the problem of the Apocalypse, which may require two Johns! 85. Iren. adv. Haer. iii. 11. 7. 86. Comm. in Joan. i. 6.
  • 41. Transcriber’s Notes: Missing or obscured punctuation was silently corrected. Typographical errors were silently corrected. Inconsistent spelling and hyphenation were made consistent only when a predominant form was found in this book. Footnotes have been collected at the end of the text, and are linked for ease of reference.
  • 42. *** END OF THE PROJECT GUTENBERG EBOOK THE CRITICISM OF THE FOURTH GOSPEL *** Updated editions will replace the previous one—the old editions will be renamed. Creating the works from print editions not protected by U.S. copyright law means that no one owns a United States copyright in these works, so the Foundation (and you!) can copy and distribute it in the United States without permission and without paying copyright royalties. Special rules, set forth in the General Terms of Use part of this license, apply to copying and distributing Project Gutenberg™ electronic works to protect the PROJECT GUTENBERG™ concept and trademark. Project Gutenberg is a registered trademark, and may not be used if you charge for an eBook, except by following the terms of the trademark license, including paying royalties for use of the Project Gutenberg trademark. If you do not charge anything for copies of this eBook, complying with the trademark license is very easy. You may use this eBook for nearly any purpose such as creation of derivative works, reports, performances and research. Project Gutenberg eBooks may be modified and printed and given away—you may do practically ANYTHING in the United States with eBooks not protected by U.S. copyright law. Redistribution is subject to the trademark license, especially commercial redistribution. START: FULL LICENSE
  • 43. THE FULL PROJECT GUTENBERG LICENSE
  • 44. PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK To protect the Project Gutenberg™ mission of promoting the free distribution of electronic works, by using or distributing this work (or any other work associated in any way with the phrase “Project Gutenberg”), you agree to comply with all the terms of the Full Project Gutenberg™ License available with this file or online at www.gutenberg.org/license. Section 1. General Terms of Use and Redistributing Project Gutenberg™ electronic works 1.A. By reading or using any part of this Project Gutenberg™ electronic work, you indicate that you have read, understand, agree to and accept all the terms of this license and intellectual property (trademark/copyright) agreement. If you do not agree to abide by all the terms of this agreement, you must cease using and return or destroy all copies of Project Gutenberg™ electronic works in your possession. If you paid a fee for obtaining a copy of or access to a Project Gutenberg™ electronic work and you do not agree to be bound by the terms of this agreement, you may obtain a refund from the person or entity to whom you paid the fee as set forth in paragraph 1.E.8. 1.B. “Project Gutenberg” is a registered trademark. It may only be used on or associated in any way with an electronic work by people who agree to be bound by the terms of this agreement. There are a few things that you can do with most Project Gutenberg™ electronic works even without complying with the full terms of this agreement. See paragraph 1.C below. There are a lot of things you can do with Project Gutenberg™ electronic works if you follow the terms of this agreement and help preserve free future access to Project Gutenberg™ electronic works. See paragraph 1.E below.
  • 45. 1.C. The Project Gutenberg Literary Archive Foundation (“the Foundation” or PGLAF), owns a compilation copyright in the collection of Project Gutenberg™ electronic works. Nearly all the individual works in the collection are in the public domain in the United States. If an individual work is unprotected by copyright law in the United States and you are located in the United States, we do not claim a right to prevent you from copying, distributing, performing, displaying or creating derivative works based on the work as long as all references to Project Gutenberg are removed. Of course, we hope that you will support the Project Gutenberg™ mission of promoting free access to electronic works by freely sharing Project Gutenberg™ works in compliance with the terms of this agreement for keeping the Project Gutenberg™ name associated with the work. You can easily comply with the terms of this agreement by keeping this work in the same format with its attached full Project Gutenberg™ License when you share it without charge with others. 1.D. The copyright laws of the place where you are located also govern what you can do with this work. Copyright laws in most countries are in a constant state of change. If you are outside the United States, check the laws of your country in addition to the terms of this agreement before downloading, copying, displaying, performing, distributing or creating derivative works based on this work or any other Project Gutenberg™ work. The Foundation makes no representations concerning the copyright status of any work in any country other than the United States. 1.E. Unless you have removed all references to Project Gutenberg: 1.E.1. The following sentence, with active links to, or other immediate access to, the full Project Gutenberg™ License must appear prominently whenever any copy of a Project Gutenberg™ work (any work on which the phrase “Project
  • 46. Gutenberg” appears, or with which the phrase “Project Gutenberg” is associated) is accessed, displayed, performed, viewed, copied or distributed: This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. 1.E.2. If an individual Project Gutenberg™ electronic work is derived from texts not protected by U.S. copyright law (does not contain a notice indicating that it is posted with permission of the copyright holder), the work can be copied and distributed to anyone in the United States without paying any fees or charges. If you are redistributing or providing access to a work with the phrase “Project Gutenberg” associated with or appearing on the work, you must comply either with the requirements of paragraphs 1.E.1 through 1.E.7 or obtain permission for the use of the work and the Project Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9. 1.E.3. If an individual Project Gutenberg™ electronic work is posted with the permission of the copyright holder, your use and distribution must comply with both paragraphs 1.E.1 through 1.E.7 and any additional terms imposed by the copyright holder. Additional terms will be linked to the Project Gutenberg™ License for all works posted with the permission of the copyright holder found at the beginning of this work. 1.E.4. Do not unlink or detach or remove the full Project Gutenberg™ License terms from this work, or any files
  • 47. containing a part of this work or any other work associated with Project Gutenberg™. 1.E.5. Do not copy, display, perform, distribute or redistribute this electronic work, or any part of this electronic work, without prominently displaying the sentence set forth in paragraph 1.E.1 with active links or immediate access to the full terms of the Project Gutenberg™ License. 1.E.6. You may convert to and distribute this work in any binary, compressed, marked up, nonproprietary or proprietary form, including any word processing or hypertext form. However, if you provide access to or distribute copies of a Project Gutenberg™ work in a format other than “Plain Vanilla ASCII” or other format used in the official version posted on the official Project Gutenberg™ website (www.gutenberg.org), you must, at no additional cost, fee or expense to the user, provide a copy, a means of exporting a copy, or a means of obtaining a copy upon request, of the work in its original “Plain Vanilla ASCII” or other form. Any alternate format must include the full Project Gutenberg™ License as specified in paragraph 1.E.1. 1.E.7. Do not charge a fee for access to, viewing, displaying, performing, copying or distributing any Project Gutenberg™ works unless you comply with paragraph 1.E.8 or 1.E.9. 1.E.8. You may charge a reasonable fee for copies of or providing access to or distributing Project Gutenberg™ electronic works provided that: • You pay a royalty fee of 20% of the gross profits you derive from the use of Project Gutenberg™ works calculated using the method you already use to calculate your applicable taxes. The fee is owed to the owner of the Project Gutenberg™ trademark, but he has agreed to donate royalties under this paragraph to the Project Gutenberg Literary Archive Foundation. Royalty
  • 48. payments must be paid within 60 days following each date on which you prepare (or are legally required to prepare) your periodic tax returns. Royalty payments should be clearly marked as such and sent to the Project Gutenberg Literary Archive Foundation at the address specified in Section 4, “Information about donations to the Project Gutenberg Literary Archive Foundation.” • You provide a full refund of any money paid by a user who notifies you in writing (or by e-mail) within 30 days of receipt that s/he does not agree to the terms of the full Project Gutenberg™ License. You must require such a user to return or destroy all copies of the works possessed in a physical medium and discontinue all use of and all access to other copies of Project Gutenberg™ works. • You provide, in accordance with paragraph 1.F.3, a full refund of any money paid for a work or a replacement copy, if a defect in the electronic work is discovered and reported to you within 90 days of receipt of the work. • You comply with all other terms of this agreement for free distribution of Project Gutenberg™ works. 1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™ electronic work or group of works on different terms than are set forth in this agreement, you must obtain permission in writing from the Project Gutenberg Literary Archive Foundation, the manager of the Project Gutenberg™ trademark. Contact the Foundation as set forth in Section 3 below. 1.F. 1.F.1. Project Gutenberg volunteers and employees expend considerable effort to identify, do copyright research on, transcribe and proofread works not protected by U.S. copyright
  • 49. law in creating the Project Gutenberg™ collection. Despite these efforts, Project Gutenberg™ electronic works, and the medium on which they may be stored, may contain “Defects,” such as, but not limited to, incomplete, inaccurate or corrupt data, transcription errors, a copyright or other intellectual property infringement, a defective or damaged disk or other medium, a computer virus, or computer codes that damage or cannot be read by your equipment. 1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for the “Right of Replacement or Refund” described in paragraph 1.F.3, the Project Gutenberg Literary Archive Foundation, the owner of the Project Gutenberg™ trademark, and any other party distributing a Project Gutenberg™ electronic work under this agreement, disclaim all liability to you for damages, costs and expenses, including legal fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE. 1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you discover a defect in this electronic work within 90 days of receiving it, you can receive a refund of the money (if any) you paid for it by sending a written explanation to the person you received the work from. If you received the work on a physical medium, you must return the medium with your written explanation. The person or entity that provided you with the defective work may elect to provide a replacement copy in lieu of a refund. If you received the work electronically, the person or entity providing it to you may choose to give you a second opportunity to receive the work electronically in lieu of a refund.
  • 50. If the second copy is also defective, you may demand a refund in writing without further opportunities to fix the problem. 1.F.4. Except for the limited right of replacement or refund set forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PURPOSE. 1.F.5. Some states do not allow disclaimers of certain implied warranties or the exclusion or limitation of certain types of damages. If any disclaimer or limitation set forth in this agreement violates the law of the state applicable to this agreement, the agreement shall be interpreted to make the maximum disclaimer or limitation permitted by the applicable state law. The invalidity or unenforceability of any provision of this agreement shall not void the remaining provisions. 1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation, the trademark owner, any agent or employee of the Foundation, anyone providing copies of Project Gutenberg™ electronic works in accordance with this agreement, and any volunteers associated with the production, promotion and distribution of Project Gutenberg™ electronic works, harmless from all liability, costs and expenses, including legal fees, that arise directly or indirectly from any of the following which you do or cause to occur: (a) distribution of this or any Project Gutenberg™ work, (b) alteration, modification, or additions or deletions to any Project Gutenberg™ work, and (c) any Defect you cause. Section 2. Information about the Mission of Project Gutenberg™
  • 51. Project Gutenberg™ is synonymous with the free distribution of electronic works in formats readable by the widest variety of computers including obsolete, old, middle-aged and new computers. It exists because of the efforts of hundreds of volunteers and donations from people in all walks of life. Volunteers and financial support to provide volunteers with the assistance they need are critical to reaching Project Gutenberg™’s goals and ensuring that the Project Gutenberg™ collection will remain freely available for generations to come. In 2001, the Project Gutenberg Literary Archive Foundation was created to provide a secure and permanent future for Project Gutenberg™ and future generations. To learn more about the Project Gutenberg Literary Archive Foundation and how your efforts and donations can help, see Sections 3 and 4 and the Foundation information page at www.gutenberg.org. Section 3. Information about the Project Gutenberg Literary Archive Foundation The Project Gutenberg Literary Archive Foundation is a non- profit 501(c)(3) educational corporation organized under the laws of the state of Mississippi and granted tax exempt status by the Internal Revenue Service. The Foundation’s EIN or federal tax identification number is 64-6221541. Contributions to the Project Gutenberg Literary Archive Foundation are tax deductible to the full extent permitted by U.S. federal laws and your state’s laws. The Foundation’s business office is located at 809 North 1500 West, Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up to date contact information can be found at the Foundation’s website and official page at www.gutenberg.org/contact
  • 52. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com