Cleanup and refactoring
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,5 +17,6 @@ npm-debug.log
|
|||||||
node_modules
|
node_modules
|
||||||
.idea
|
.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
public/vendor
|
public/vendor
|
20
LICENSE
20
LICENSE
@ -1,20 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013 Sahat Yalkabov
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Sendgrid
|
||||||
|
Facebook
|
||||||
|
Rdio
|
||||||
|
Tumblr
|
||||||
|
Twitter
|
||||||
|
Twilio
|
||||||
|
Etsy
|
||||||
|
Foursquare
|
||||||
|
New York Times
|
@ -3,30 +3,26 @@ var express = require('express'),
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
mongoose = require('mongoose'),
|
mongoose = require('mongoose'),
|
||||||
passport = require('passport'),
|
passport = require('passport');
|
||||||
|
|
||||||
config = require('./config'),
|
// Configuration (API Keys, Database URI)
|
||||||
|
var config = require('./config.json');
|
||||||
|
|
||||||
// Load controllers
|
// Load controllers
|
||||||
home = require('./controllers/home'),
|
var home = require('./controllers/home'),
|
||||||
api = require('./controllers/api'),
|
api = require('./controllers/api'),
|
||||||
auth = require('./controllers/auth'),
|
auth = require('./controllers/auth'),
|
||||||
users = require('./controllers/users');
|
users = require('./controllers/user');
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
mongoose.connect(config.db, function(err, res) {
|
var db = mongoose.connect(config.db);
|
||||||
if (err) {
|
|
||||||
console.log ('Error connecting to database: ' + err);
|
|
||||||
} else {
|
|
||||||
console.log ('Successfully connected to database!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var app = module.exports = express();
|
// Initialize express application
|
||||||
|
var app = express();
|
||||||
|
|
||||||
app.set('port', process.env.PORT || 3000);
|
app.set('port', process.env.PORT || 3000);
|
||||||
app.set('views', __dirname + '/views');
|
app.set('views', __dirname + '/views');
|
||||||
app.set('view engine', 'jade');
|
app.set('view engine', 'hbs');
|
||||||
app.use(express.logger('dev'));
|
app.use(express.logger('dev'));
|
||||||
app.use(express.errorHandler());
|
app.use(express.errorHandler());
|
||||||
app.use(express.favicon());
|
app.use(express.favicon());
|
||||||
@ -42,14 +38,13 @@ app.use(app.router);
|
|||||||
// Routes
|
// Routes
|
||||||
app.get('/', home.index);
|
app.get('/', home.index);
|
||||||
|
|
||||||
//app.get('/account', auth.ensureAuthenticated, users.account);
|
app.get('/account', auth.ensureAuthenticated, users.account);
|
||||||
app.get('/logout', users.logout);
|
app.get('/logout', users.logout);
|
||||||
app.post('/login', users.postlogin);
|
app.post('/login', users.postlogin);
|
||||||
//app.get('/admin', auth.ensureAuthenticated, auth.ensureAdmin(), users.admin);
|
app.get('/admin', auth.ensureAuthenticated, auth.ensureAdmin(), users.admin);
|
||||||
//app.get('/api/name', api.name);
|
app.get('/api/name', api.name);
|
||||||
app.get('/partials/login', users.getlogin);
|
app.get('/partials/login', users.getlogin);
|
||||||
app.get('/partials/:name', home.partials);
|
app.get('/partials/:name', home.partials);
|
||||||
|
|
||||||
app.get('*', home.index);
|
app.get('*', home.index);
|
||||||
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
var mongoose = require('mongoose'),
|
var mongoose = require('mongoose'),
|
||||||
passport = require('passport'),
|
passport = require('passport');
|
||||||
User = require('../models/user');
|
|
||||||
|
// Import models
|
||||||
|
var User = require('../models/user');
|
||||||
|
|
||||||
exports.account = function(req, res) {
|
exports.account = function(req, res) {
|
||||||
res.render('account', { user: req.user });
|
res.render('account', { user: req.user });
|
@ -1,6 +1,7 @@
|
|||||||
var mongoose = require('mongoose'),
|
var mongoose = require('mongoose'),
|
||||||
bcrypt = require('bcrypt');
|
bcrypt = require('bcrypt');
|
||||||
|
|
||||||
|
|
||||||
var userSchema = new mongoose.Schema({
|
var userSchema = new mongoose.Schema({
|
||||||
username: { type: String, required: true, unique: true },
|
username: { type: String, required: true, unique: true },
|
||||||
email: { type: String, required: true, unique: true },
|
email: { type: String, required: true, unique: true },
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"passport": "latest",
|
"passport": "latest",
|
||||||
"passport-local": "latest",
|
"passport-local": "latest",
|
||||||
"underscore": "latest",
|
"underscore": "latest",
|
||||||
"forever": "latest"
|
"forever": "latest",
|
||||||
|
"hbs": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,8 +16,9 @@ angular.module('myApp', ['ngRoute', 'myApp.filters', 'myApp.services', 'myApp.di
|
|||||||
templateUrl: 'partials/login',
|
templateUrl: 'partials/login',
|
||||||
controller: MyCtrl3
|
controller: MyCtrl3
|
||||||
});
|
});
|
||||||
$routeProvider.when('/logout', {
|
|
||||||
|
|
||||||
|
$routeProvider.when('/logout', {
|
||||||
|
controller: MyCtrl4
|
||||||
});
|
});
|
||||||
$routeProvider.otherwise({ redirectTo: '/view1' });
|
$routeProvider.otherwise({ redirectTo: '/view1' });
|
||||||
$locationProvider.html5Mode(true);
|
$locationProvider.html5Mode(true);
|
||||||
|
@ -19,5 +19,12 @@ MyCtrl1.$inject = [];
|
|||||||
function MyCtrl2() {
|
function MyCtrl2() {
|
||||||
}
|
}
|
||||||
MyCtrl2.$inject = [];
|
MyCtrl2.$inject = [];
|
||||||
|
|
||||||
function MyCtrl3() {}
|
function MyCtrl3() {}
|
||||||
MyCtrl3.$inject = [];
|
MyCtrl3.$inject = [];
|
||||||
|
|
||||||
|
|
||||||
|
function MyCtrl4($scope, $http) {
|
||||||
|
$http({ method: 'GET', url: '/logout' });
|
||||||
|
}
|
||||||
|
MyCtrl4.$inject = [];
|
||||||
|
@ -26,6 +26,7 @@ block body
|
|||||||
div(ng-controller='AppCtrl')
|
div(ng-controller='AppCtrl')
|
||||||
.jumbotron
|
.jumbotron
|
||||||
h1 Hello {{name}}
|
h1 Hello {{name}}
|
||||||
|
h2 3 times 3 mod 3 is {{3*3%3}}
|
||||||
div(ng-view)
|
div(ng-view)
|
||||||
br
|
br
|
||||||
button.btn.btn-labeled.btn-success(type='button')
|
button.btn.btn-labeled.btn-success(type='button')
|
||||||
|
Reference in New Issue
Block a user