This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from jeffbcross/universal-worker
feature(universal) add universal support
- Loading branch information
Showing
19 changed files
with
1,731 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "dist/app/main-server.js", | ||
"stopOnEntry": false, | ||
"args": [], | ||
"cwd": ".", | ||
"runtimeExecutable": null, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": false, | ||
"outDir": null | ||
}, | ||
{ | ||
"name": "Attach", | ||
"type": "node", | ||
"request": "attach", | ||
"port": 5858 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// <reference path="../typings/tsd.d.ts" /> | ||
|
||
import * as path from 'path'; | ||
import * as express from 'express'; | ||
import {SERVER_LOCATION_PROVIDERS, ng2engine} from 'angular2-universal-preview/dist/server'; | ||
|
||
import {provide} from 'angular2/core'; | ||
import {APP_BASE_HREF, ROUTER_PROVIDERS} from 'angular2/router'; | ||
|
||
import {SHARED_PROVIDERS} from './shared-providers'; | ||
|
||
// Angular 2 | ||
import {App} from './app/app'; | ||
|
||
let app = express(); | ||
let root = path.join(path.resolve(__dirname, '..')); | ||
|
||
// Express View | ||
app.engine('.ng2.html', ng2engine); | ||
app.set('views', root); | ||
app.set('view engine', 'ng2.html'); | ||
|
||
// Serve static files | ||
app.use(express.static(root)); | ||
|
||
// Routes | ||
app.use('/', (req, res) => { | ||
res.render('index', { App, providers: [ | ||
ROUTER_PROVIDERS, | ||
SERVER_LOCATION_PROVIDERS, | ||
provide(APP_BASE_HREF, {useValue: `http://localhost:3000${req.baseUrl}`}), | ||
SHARED_PROVIDERS | ||
] }); | ||
}); | ||
|
||
// Server | ||
app.listen(3000, () => { | ||
console.log('Listen on http://localhost:3000'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
import {bootstrap} from 'angular2/platform/browser'; | ||
import {platform, provide} from 'angular2/core'; | ||
import {ROUTER_PROVIDERS} from 'angular2/router'; | ||
import {ROUTER_PROVIDERS, LocationStrategy, PathLocationStrategy} from 'angular2/router'; | ||
|
||
import {AuthService} from './services/Auth'; | ||
import {Backend, BackendConfig} from './services/Backend'; | ||
import {Nav} from './services/Nav'; | ||
|
||
const FIREBASE_URL = 'https://ng2-forum-demo.firebaseio.com'; | ||
import {SHARED_PROVIDERS} from './shared-providers'; | ||
|
||
import {App} from './app/app'; | ||
|
||
bootstrap(App,[ | ||
bootstrap(App, [ | ||
ROUTER_PROVIDERS, | ||
AuthService, | ||
Backend, | ||
provide(BackendConfig, {useValue: {url: FIREBASE_URL }}) | ||
SHARED_PROVIDERS, | ||
provide(LocationStrategy, {useClass: PathLocationStrategy}) | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {provide} from 'angular2/core'; | ||
|
||
import {AuthService} from './services/Auth'; | ||
import {Backend, BackendConfig} from './services/Backend'; | ||
|
||
export const FIREBASE_URL = 'https://ng2-forum-demo.firebaseio.com'; | ||
|
||
export const SHARED_PROVIDERS = [ | ||
AuthService, | ||
Backend, | ||
provide(BackendConfig, {useValue: {url: FIREBASE_URL }}) | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": "v4", | ||
"repo": "borisyankov/DefinitelyTyped", | ||
"ref": "master", | ||
"path": "typings", | ||
"bundle": "typings/tsd.d.ts", | ||
"installed": { | ||
"firebase/firebase.d.ts": { | ||
"commit": "2cad4a3cff770c37b40496188c246b1a60e87e2d" | ||
}, | ||
"mime/mime.d.ts": { | ||
"commit": "2cad4a3cff770c37b40496188c246b1a60e87e2d" | ||
}, | ||
"serve-static/serve-static.d.ts": { | ||
"commit": "2cad4a3cff770c37b40496188c246b1a60e87e2d" | ||
}, | ||
"express/express.d.ts": { | ||
"commit": "2cad4a3cff770c37b40496188c246b1a60e87e2d" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Eventually typings should not be included in version control. | ||
|
||
Right now they must be, because the installed typings have to | ||
be manually updated to prevent duplication with node.d.ts typings | ||
included with angular2. | ||
|
||
Local edits: remove reference to node.d.ts from express.d.ts. | ||
|
||
(@jeffbcross 2016-01-21) |
Oops, something went wrong.