Skip to content

Commit e36a84a

Browse files
author
erundle
committed
Enabling CI
1 parent bf4c70b commit e36a84a

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

Gruntfile.js

+6
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ module.exports = function (grunt) {
229229
grunt.task.run(['clean', 'lint', 'test', 'ngtemplates', 'concat', 'ngAnnotate', 'uglify:build', 'cssmin', 'copy', 'ngdocs', 'clean:templates']);
230230
});
231231

232+
// Runs all the tasks of build with the exception of tests
233+
grunt.registerTask('deploy', 'Prepares the project for deployment. Does not run unit tests', function () {
234+
var concatSrc = 'src/**/*.js';
235+
grunt.task.run(['clean', 'lint', 'ngtemplates', 'concat', 'ngAnnotate', 'uglify:build', 'cssmin', 'copy', 'ngdocs', 'clean:templates']);
236+
});
237+
232238
grunt.registerTask('default', ['build']);
233239
grunt.registerTask('ngdocs:view', ['build', 'connect:docs', 'watch']);
234240
grunt.registerTask('lint', ['eslint', 'htmlhint']);

server.js

+18-27
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
11
'use strict';
22

3-
var fs =require('fs'); //for image upload file handling
4-
53
var express = require('express');
6-
var app = express();
7-
8-
var port =3000;
9-
var host ='localhost';
10-
var serverPath ='/';
11-
var staticPath ='/';
12-
13-
var staticFilePath = __dirname + serverPath;
14-
// remove trailing slash if present
15-
if(staticFilePath.substr(-1) === '/'){
16-
staticFilePath = staticFilePath.substr(0, staticFilePath.length - 1);
17-
}
4+
var http = require('http');
5+
var ipaddress = process.env.OPENSHIFT_NODEJS_IP || 'localhost';
6+
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
187

19-
app.configure(function(){
20-
// compress static content
21-
app.use(express.compress());
22-
app.use(serverPath, express.static(staticFilePath)); //serve static files
23-
24-
app.use(express.bodyParser()); //for post content / files - not sure if this is actually necessary?
25-
});
8+
var app = express();
269

27-
//catch all route to serve index.html (main frontend app)
28-
app.get('*', function(req, res){
29-
res.sendfile(staticFilePath + staticPath+ 'index.html');
10+
// A shutdown handler to log when we quit.
11+
process.on('exit', function() {
12+
console.log('%s: INFO - Node server is shutting down.',
13+
Date(Date.now()));
3014
});
3115

32-
app.listen(port);
33-
34-
console.log('Server running at http://'+host+':'+port.toString()+'/');
16+
try {
17+
app.use(express.static('./dist/docs'));
18+
console.log('%s: INFO - Node server started on %s:%d ...',
19+
Date(Date.now()), ipaddress, port);
20+
http.createServer(app).listen(port, ipaddress);
21+
}
22+
catch (err) {
23+
console.log('%s: ERROR - Problem starting node server%s',
24+
Date(Date.now()), err);
25+
}

0 commit comments

Comments
 (0)