Main app file. This file runs the web application.
- Source:
Requires
- module:express
- module:body-parser
- module:mongoose
- module:passport
- module:passport-local
- module:method-override
- module:connect-flash
- module:moment
- module:lib/models/user
- module:lib/models/campground
- module:lib/models/comment
- module:lib/routes/index
- module:lib/routes/campgrounds
- module:lib/routes/comments
- module:lib/routes/errors
- module:dotenv
Members
(inner, constant) DB_URL
Connection URI to database cluster.
- Source:
- See:
-
- https://docs.mongodb.com/ecosystem/drivers/node/ for more details.
(inner, constant) DB_URL_LOCAL
local database port
- Default Value:
- mongodb://localhost:27017/yelp_camp
- Source:
(inner) momment-middleware memberof module:lib/app
Moment middleware module used for determining time at which an event occurs.
- Source:
(inner) mongoose-promise-setter
Sets type of promises used by mongoose.
- Source:
(inner, constant) port
Tell Express to listen for requests (start server)
- Source:
Methods
(inner) app/listen(port)
Middleware for starting a UNIX socket and listens for connections on a given path.
Parameters:
Name | Type | Description |
---|---|---|
port |
string | Connection path for main application. |
|
callback | Callback used for presenting visual text confirmation of connection. |
- Source:
(inner) mongoose-connection(DB_URI)
Connect to MongoDB instance with Connection URI.
Parameters:
Name | Type | Description |
---|---|---|
DB_URI |
string | Connection URI for connecting to MongoDB |
- Source:
(inner) set/useCreateIndex(deprecationType)
Fix deprecation warnings for using MongoDB driver's ensureIndex() method.
Parameters:
Name | Type | Description |
---|---|---|
deprecationType |
string | deprecation warning type |
|
boolean | set to true if MongoDB driver's createIndex() method should be used instead. |
- Source:
(inner) set/useFindAndModify(deprecationType)
Fix deprecation warnings for using Mongoose native findOneAndUpdate method.
Parameters:
Name | Type | Description |
---|---|---|
deprecationType |
string | deprecation warning type |
|
boolean | set to true if MongoDB driver's findOneAndUpdate() should be used. |
- Source:
(inner) set/useNewUrlParser(deprecationType)
Fix deprecation warnings for parsing MongoDB connection strings.
Parameters:
Name | Type | Description |
---|---|---|
deprecationType |
string | deprecation warning type |
|
boolean | set to true if new tool for parsing MongoDB connection strings should be used. |
- Source:
(inner) set/useUnifiedTopology(deprecationType)
Fix deprecation warnings for the use of the new MongoDB driver's topology engine.
Parameters:
Name | Type | Description |
---|---|---|
deprecationType |
string | deprecation warning type |
|
boolean | set to true if MongoDB driver's new topology engine should be used. |
- Source:
(inner) set/view-engine(viewEngine, path)
Sets the view engine as being ejs (embedded javascript).
Parameters:
Name | Type | Description |
---|---|---|
viewEngine |
string | view engine variable |
path |
string | The default engine extension to use when omitted. |
- Source:
(inner) set/views(views, path)
Sets the path in which the views folder is found.
Parameters:
Name | Type | Description |
---|---|---|
views |
string | views folder name |
path |
string | path of views folder |
- Source:
(inner) use/body-parser(middleware)
Sets parsing of the URL-encoded data to be done with the qs library.
Parameters:
Name | Type | Description |
---|---|---|
middleware |
callback | body parser middleware |
- Source:
(inner) use/campground-routes(path, cb)
Middleware for defining module:lib/models/campground route groups.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | path for which specified routes are invoked |
cb |
callback | campground routes module. |
- Source:
(inner) use/comment-routes(path, cb)
Middleware for defining module:lib/models/comment route groups.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | path for which specified routes are invoked |
cb |
callback | comment routes module. |
- Source:
(inner) use/deserialize-user(cb)
Middleware for deserializing user instance to and from session.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used deserialization. |
- Source:
(inner) use/error-routes(path, cb)
Middleware for defining error route groups.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | path for which specified routes are invoked |
cb |
callback | error routes module. |
- Source:
(inner) use/express-session(cb)
Session middleware.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used for configuring session. |
- Source:
(inner) use/flash(cb)
Enable flash middleware for flashing messages to a user's screen.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | Flash initializer callback. |
- Source:
(inner) use/index-routes(cb)
Middleware for defining index route groups (generally routes for model:lib/models/user)
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | index routes module. |
- Source:
(inner) use/initialize-webpage-vars(cb)
Middleware for setting currentUser local application variable, populating user notifications, and setting error or success messages if available.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used for setting web page variables. |
- Source:
(inner) use/local-strategy(cb)
Middleware for defining the Passport local strategy as defined by module:lib/models/user.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used for configuring local strategy. |
- Source:
(inner) use/method-override(getter)
Override the express.req.method property with a new value (string).
Parameters:
Name | Type | Description |
---|---|---|
getter |
string | The getter to use to look up the overridden request method for the request. |
- Source:
(inner) use/passport-initialize(cb)
Middleware for initializing Passport module.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used for initializing session. |
- Source:
(inner) use/passport-session(cb)
Middleware for allowing Passport module to work with persistent login sessions.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used for configuring passport session. |
- Source:
(inner) use/serialize-user(cb)
Middleware for serializing user instance to and from session.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | callback used serialization. |
- Source:
(inner) use/static-content(cb)
Set the path from which static content for the app will be served.
Parameters:
Name | Type | Description |
---|---|---|
cb |
callback | Callback with path from which static content for the app will be served. |
- Source: