FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
chapter12-frameworks/angular2/src/main.server.js at master · isomorphic-dev-js/chapter12-frameworks · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
isomorphic-dev-js
/
chapter12-frameworks
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
chapter12-frameworks
/
angular2
/
src
/
main.server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (28 loc) · 1.1 KB
Breadcrumbs
chapter12-frameworks
/
angular2
/
src
/
main.server.js
Copy path
File metadata and controls
28 lines (28 loc) · 1.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"use strict"
;
exports
.
__esModule
=
true
;
require
(
"reflect-metadata"
)
;
require
(
"zone.js/dist/zone-node"
)
;
var
platform_server_1
=
require
(
"@angular/platform-server"
)
;
var
core_1
=
require
(
"@angular/core"
)
;
var
app_server_module_ngfactory_1
=
require
(
"./app.server.module.ngfactory"
)
;
var
express
=
require
(
"express"
)
;
var
fs_1
=
require
(
"fs"
)
;
var
path_1
=
require
(
"path"
)
;
var
PORT
=
4000
;
core_1
.
enableProdMode
(
)
;
var
app
=
express
(
)
;
var
template
=
fs_1
.
readFileSync
(
path_1
.
join
(
__dirname
,
'..'
,
'dist'
,
'index.html'
)
)
.
toString
(
)
;
app
.
engine
(
'html'
,
function
(
_
,
options
,
callback
)
{
var
opts
=
{
document
:
template
,
url
:
options
.
req
.
url
}
;
platform_server_1
.
renderModuleFactory
(
app_server_module_ngfactory_1
.
AppServerModuleNgFactory
,
opts
)
.
then
(
function
(
html
)
{
return
callback
(
null
,
html
)
;
}
)
;
}
)
;
app
.
set
(
'view engine'
,
'html'
)
;
app
.
set
(
'views'
,
'src'
)
;
app
.
get
(
'*.*'
,
express
.
static
(
path_1
.
join
(
__dirname
,
'..'
,
'dist'
)
)
)
;
app
.
get
(
'*'
,
function
(
req
,
res
)
{
res
.
render
(
'index'
,
{
req
:
req
}
)
;
}
)
;
app
.
listen
(
PORT
,
function
(
)
{
console
.
log
(
"listening on http://localhost:"
+
PORT
+
"!"
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL