forked from rangle/angular-ssr
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor on-demand express example to beef it up and demonstrate abil…
…ity to use HTTP
- Loading branch information
Showing
34 changed files
with
233 additions
and
92 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,28 @@ | ||
{ | ||
"name": "@angular-ssr/client", | ||
"version": "0.1.98", | ||
"description": "Browser companion library for angular-ssr", | ||
"main": "build/index.js", | ||
"typings": "build/index.d.ts", | ||
"engines": { | ||
"node": ">=6.9", | ||
"npm": ">=3.10" | ||
}, | ||
"scripts": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/clbond/angular-ssr.git" | ||
}, | ||
"author": { | ||
"name": "Christopher Bond", | ||
"email": "cb@clbond.org", | ||
"url": "https://clbond.org/" | ||
}, | ||
|
||
"contributors": [ | ||
{ | ||
"name": "rangle.io", | ||
"url": "https://rangle.io/" | ||
} | ||
] | ||
} |
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
This file was deleted.
Oops, something went wrong.
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,3 +1,5 @@ | ||
export * from './blog.component'; | ||
export * from './blog.model'; | ||
export * from './blog.service'; | ||
export * from './model'; | ||
export * from './module'; | ||
export * from './service'; | ||
export * from './schema'; |
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,21 @@ | ||
import {RouterModule} from '@angular/router'; | ||
import {CommonModule} from '@angular/common'; | ||
import {NgModule} from '@angular/core'; | ||
|
||
import {HttpModule} from '@angular/http'; | ||
|
||
import {BlogService} from './service'; | ||
import {BlogComponent} from './blog.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
HttpModule, | ||
RouterModule.forChild([ | ||
{path: ':id', component: BlogComponent} | ||
]) | ||
], | ||
declarations: [BlogComponent], | ||
providers: [{provide: BlogService, useClass: BlogService}] | ||
}) | ||
export class BlogModule {} |
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,24 @@ | ||
import {Validator, ValidatorResult, Schema} from 'jsonschema'; | ||
|
||
const blogsSchema: Schema = { | ||
$schema: 'http://json-schema.org/draft-04/schema#', | ||
type: 'object', | ||
properties: { | ||
".*$": { | ||
type: 'array', | ||
properties: { | ||
title: {type: 'string'}, | ||
content: {type: 'string'}, | ||
author: {type: 'object', | ||
properties: { | ||
name: {type: 'string'}, | ||
email: {type: 'string'} | ||
} | ||
} | ||
} | ||
}, | ||
} | ||
}; | ||
|
||
export const validateBlogsAgainstSchema = (blogs): ValidatorResult => | ||
new Validator().validate(blogs, blogsSchema); |
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,16 @@ | ||
import {Injectable} from '@angular/core'; | ||
|
||
import {Http} from '@angular/http'; | ||
|
||
import {Observable} from 'rxjs'; | ||
|
||
import {Blog} from './model'; | ||
|
||
@Injectable() | ||
export class BlogService { | ||
constructor(private http: Http) {} | ||
|
||
load(locale: string): Observable<ArrayLike<Blog>> { | ||
return this.http.get('https://raw.githubusercontent.com/clbond/angular-ssr/master/examples/demand-express/mock-content.json').map(r => r.json()).map(c => c[locale]); | ||
} | ||
} |
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,2 @@ | ||
export * from './module'; | ||
export * from './service'; |
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,8 @@ | ||
import {NgModule} from '@angular/core'; | ||
|
||
import {CookieService} from './service'; | ||
|
||
@NgModule({ | ||
providers: [CookieService] | ||
}) | ||
export class CookieModule {} |
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,2 @@ | ||
export * from './dialog-content.component'; | ||
export * from './module'; |
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 @@ | ||
import {NgModule} from '@angular/core'; | ||
|
||
import {DialogContent} from './dialog-content.component'; | ||
|
||
@NgModule({ | ||
declarations: [DialogContent], | ||
exports: [DialogContent] | ||
}) | ||
export class DialogModule {} |
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,2 +1,3 @@ | ||
export * from './locale.component'; | ||
export * from './locale.service'; | ||
export * from './selector.component'; | ||
export * from './module'; | ||
export * from './service'; |
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,16 @@ | ||
import {CommonModule} from '@angular/common'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {NgModule} from '@angular/core'; | ||
import {MdSelectModule} from '@angular/material'; | ||
|
||
import {LocaleSelectorComponent} from './selector.component'; | ||
|
||
import {LocaleService} from './service'; | ||
|
||
@NgModule({ | ||
declarations: [LocaleSelectorComponent], | ||
exports: [LocaleSelectorComponent], | ||
imports: [CommonModule, FormsModule, MdSelectModule], | ||
providers: [LocaleService] | ||
}) | ||
export class LocaleModule {} |
2 changes: 1 addition & 1 deletion
2
...-express/app/locale/locale.component.html → ...xpress/app/locale/selector.component.html
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
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
Oops, something went wrong.