Merge branch 'master' of github.com:whitef0x0/medforms

This commit is contained in:
David Baldwynn 2015-07-13 15:33:36 -07:00
commit e480df05c4
7 changed files with 52 additions and 10 deletions

View file

@ -3,7 +3,9 @@
/**
* Module dependencies.
*/
exports.index = function(req, res) {
exports.index = function(req, res, next) {
// res.send('Hello World');
next(new Error("Bump!"));
res.render('index', {
user: req.user || null,
request: req

View file

@ -84,6 +84,17 @@
<script type="text/javascript" src="http://{{request.hostname}}:35729/livereload.js"></script>
{% endif %}
<script>
Raven.config('http://db01e03015ce48e2b68240ea8254b17c@sentry.polydaic.com/1', {
// Raven settings
})
.setUser({
"id": "SERVER_RENDERED_ID",
"email": "SERVER_RENDERED_EMAIL"
})
.install()
</script>
<!-- [if lt IE 9]>
<section class="browsehappy jumbotron hide">
<h1>Hello there!</h1>

View file

@ -22,7 +22,8 @@
"angular-permission": "~0.3.0",
"restangular": "~1.5.1",
"fontawesome": "~4.3.0",
"ng-file-upload": "~5.0.9"
"ng-file-upload": "~5.0.9",
"angular-raven": "~0.5.11"
},
"resolutions": {
"angular": "^1.2.21",

2
config/env/all.js vendored
View file

@ -10,7 +10,7 @@ module.exports = {
templateEngine: 'swig',
//Sentry DSN Client Key
DSN: 'http://db01e03015ce48e2b68240ea8254b17c:5d878e9bb6c6488fbb70fb81295ee700@sentry.example.com/1',
DSN: 'http://db01e03015ce48e2b68240ea8254b17c:5d878e9bb6c6488fbb70fb81295ee700@sentry.polydaic.com/1',
// The secret should be set to a non-guessable string that
// is used to compute a session hash

View file

@ -74,12 +74,6 @@ module.exports = function(db) {
// Showing stack errors
app.set('showStackError', true);
// Sentry (Raven) error reporting
app.use(raven.middleware.express.requestHandler(config.DSN));
// Should come before any other error middleware
app.use(raven.middleware.express.errorHandler(config.DSN));
// app.use(onError); // optional error handler if you want to display the error id to a user
// Set swig as the template engine
app.engine('server.view.html', consolidate[config.templateEngine]);
@ -180,6 +174,27 @@ module.exports = function(db) {
require(path.resolve(routePath))(app);
});
// Add headers
// app.use(function (req, res, next) {
// // Website you wish to allow to connect
// res.setHeader('Access-Control-Allow-Origin', 'http://sentry.polydaic.com');
// // Request methods you wish to allow
// res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
// // Request headers you wish to allow
// res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
// // Set to true if you need the website to include cookies in the requests sent
// // to the API (e.g. in case you use sessions)
// res.setHeader('Access-Control-Allow-Credentials', true);
// // Pass to next layer of middleware
// next();
// });
// Assume 'not found' in the error msgs is a 404. this is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
app.use(function(err, req, res, next) {
// If the error object doesn't exists
@ -202,6 +217,17 @@ module.exports = function(db) {
});
});
// Sentry (Raven) middleware
app.use(raven.middleware.express(config.DSN));
raven.patchGlobal(function(logged, err) {
console.error(err)
console.error(err.stack)
console.error('exiting process (after global patch)')
process.exit(1)
})
if (process.env.NODE_ENV === 'secure') {
// Load SSL key and certificate
var privateKey = fs.readFileSync('./config/sslcerts/key.pem', 'utf8');

View file

@ -1,5 +1,7 @@
'use strict';
console.log('hi');
//Start by defining the main module and adding the module dependencies
angular.module(ApplicationConfiguration.applicationModuleName, ApplicationConfiguration.applicationModuleVendorDependencies);

View file

@ -4,7 +4,7 @@
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'medform';
var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils'];
var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils', 'ngRaven'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {