forked from saymedia/angularjs-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
36 lines (31 loc) · 965 Bytes
/
server.js
File metadata and controls
36 lines (31 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var angularserver = require('../../lib/main.js');
var path = require('path');
var fs = require('fs');
var express = require('express');
var templateFile = path.join(__dirname, 'template.html');
var template = fs.readFileSync(templateFile, {encoding:'utf8'});
var staticDir = __dirname;
var app = express();
var angularMiddlewares = angularserver.Server(
{
template: template,
serverScripts: [
path.join(__dirname, 'angular.js'),
path.join(__dirname, 'common.js')
],
clientScripts: [
'/:static/angular.js',
'/:static/angular-route.js',
'/:static/common.js',
'/:static/clientonly.js'
],
angularModules: [
'simpleapp'
]
}
);
app.use('/:static', express.static(staticDir));
app.use('/:', angularMiddlewares.sdrApi);
app.use(angularMiddlewares.htmlGenerator);
app.listen(3000);
console.log('Listening on port 3000');