Skip to content

Instantly share code, notes, and snippets.

View oakinogundeji's full-sized avatar

'Muyiwa Akin-Ogundeji oakinogundeji

View GitHub Profile
@oakinogundeji
oakinogundeji / package.json
Created December 6, 2015 18:34
package.json for the express 4.x local auth example
{
"name": "chap1",
"version": "1.0.0",
"description": "A base test express app",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Telios WebDev",
"license": "ISC",
@oakinogundeji
oakinogundeji / config.js
Created December 6, 2015 18:46
config.js module for the express 4.x local auth sample app.
module.exports = require('./' + (process.env.NODE_ENV || 'development') + '.json');
@oakinogundeji
oakinogundeji / development.json
Created December 6, 2015 18:49
development.json file for the express 4.x local auth sample app.
{
"host": "localhost",
"devURL": "http://localhost:3030",
"env": "development",
"dbURL": "mongodb://localhost/xpressLocalAuth",
"sessionSecret": "qwertyuiop123456789"
}
@oakinogundeji
oakinogundeji / production.json
Created December 6, 2015 18:53
production.json module for the express 4.x local auth sample app.
{
"host": "localhost",
"devURL": "http://localhost:3030",
"env": "production",
"dbURL": "mongodb://localhost/xpressLocalAuth",
"sessionSecret": "qwertyuiop123456789"
}
@oakinogundeji
oakinogundeji / app.js
Last active December 6, 2015 20:16
main app.js file for the express 4.x local auth sample app.
/**
*Module dependencies
*/
var
express = require('express'),
logger = require('morgan'),
path = require('path'),
bParser = require('body-parser'),
session = require('express-session'),
mongoose = require('mongoose'),
@oakinogundeji
oakinogundeji / users.js
Created December 6, 2015 20:25
user model module for the express 4.x local auth sample app.
/**
*Module dependencies
*/
var
mongoose = require('mongoose'),
bcrypt = require('bcrypt-nodejs');
//==============================================================================
/**
*Module Variables
*/
@oakinogundeji
oakinogundeji / utilities.js
Created December 6, 2015 20:32
utility functions for the user model module of the express 4.x local auth sample app.
/**
*Module dependencies
*/
var UserModel = require('./users');
//==============================================================================
/**
*User Model Utility functions
*/
function errHandler(err) {
console.error('There was an error performing the operation');
@oakinogundeji
oakinogundeji / passport.js
Created December 6, 2015 20:40
passport module for the express 4.x local auth sample app.
/**
*Module dependencies
*/
var
passport = require('passport'),
config = require('./config'),
User = require('../models/users'),
utilities = require('../models/utilities');
/**
*Module variables
@oakinogundeji
oakinogundeji / login.ejs
Created December 6, 2015 21:16
login view for the express 4.x local auth sample app.
<!-- from '/views/pages/login.ejs'-->
<!DOCTYPE html>
<head>
<% include ../partials/head %>
</head>
<body>
<main class="container">
<header>
<% include ../partials/header %>
</header>
@oakinogundeji
oakinogundeji / routes.js
Created December 6, 2015 21:20
router module for the express 4.x local auth sample app.
/**
*Module dependencies
*/
var
express = require('express'),
passport = require('../config/passport'),
utilities = require('../models/utilities');
//==============================================================================
/**
*Create router instance