Join Daniel Khan for an in-depth discussion in this video Adding central configuration, part of Building a Website with Node.js and Express.js.
- [Instructor] It's always tempting…and easy to spread out data throughout an application.…Like adding the number of pages to show in a list,…where the list is defined…or some database connection information…right where it's needed to make the connection.…But very soon this can get very hard to maintain,…like when you use the same date again…and start duplicating information,…suddenly you have to keep all those places in mind…and it's not a question,…if you will forget to change one of them, but when.…That's why I create a central configuration file…for each of my projects, small or big.…
And we will do that right now.…So in our server directory,…I create a folder, config.…And in config,…I will create a new file, index.js.…I also want to make this file environment aware…because we already covered that we might need…different configurations depending on…the environment we are on.…So I start by…doing a module.exports…equals and I'm exporting an object from here…and the first property is for development.…
And this property gets sub-object,…
- Creating a server with Express and pure Node.js
- Handling errors in Express
- Creating routes
- Using templates
- Working with the Pug template engine
- Implementing the site structure and logic
- Working with conditionals
- Dealing with POST requests
- Sanitizing user inputs and handling form errors
Skill Level Beginner
What you should know1m 40s
1. Getting Started
2. Express Basics
3. Getting Started with Our Project
4. Getting Started with Templates
5. Implementing the Site Structure and Logic
6. Handling Form Data
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.