I'd dabbled with NodeJS before, but it wasn't until 2 months ago(Oct 2016) that I really tried to put as much of everything together to serve as a decent basis for web development for beginners.
I started with the Web Development With Node and Express book by Ethan Brown. But soon I realized, since the book was published in 2014, lots that were covered in the book have changed, and things that weren't covered have gained tractions since then.
Therefore, this repo consolidates and structures all of my knowledges of the opinions/experiences from StackOverflow's users, blog posts, and official docs regarding various aspects of the book, libraries and more, hoping that this would ease a beginner's learning experience that could get somewhat overwhelming like it did for me trying to catch up in the sea of information towards the latest developments.
Codes are well commented, and credits and sources are linked in the comments.
- ES2015 features.
- MVVM structure.
- Separate 'node_modules' folder for shared app's local modules. See here
- Promises pattern.
- Templating with Handlebars using express-handlebars.
- Static files serving.
- Email services using Nodemailer.
- Facebook Login user authentication using Passport.js.
- File uploading to local using Multer.
- Logging to console and file rotation using Winston and Morgan.
- MongoDB database interaction using Mongoose.
- Persistent sessions using connect-redis.
- GZIP compression using compression.
- Parse request body data using body-parser.
- Basic security measures using Helmet.
- Favicon using serve-favicon.
- A file to quickly learn the concept of how logic flows through Middlewares.
- Hot reload using Browser Sync.
- SCSS to CSS conversion using gulp-sass.
- CSS sourcemap using gulp-sourcemaps.
- CSS autoprefix using gulp-autoprefixer.
- Files revisioning and cache busting using gulp-rev and gulp-rev-replace.
Run git clone https://github.com/kilgarenone/express-consensus
in a new directory.
Run npm install
from the root directory to install all of the dependencies listed in the package.json
Run npm start
to start the app with hot-reloading enabled.
Run npm test
to run tests.
Go to localhost:3000/nursery-rhyme
for demo of client-side and server-side rendering templates.
Go to localhost:3000/vacation-photo
for demo of file uploading.
Go to localhost:3000/shops/all
for demo of facebook login authentication.
Click any of the three currencies for persistent sessions demo.
Run node learnMiddlewareFlow
from the root directory to learn about the concept of Nodejs's middleware flow controls.