-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
30 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component } from "@angular/core"; | ||
|
||
@Component({ | ||
selector: 'my-app', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
selector: "my-app", | ||
templateUrl: "./app.component.html", | ||
styleUrls: ["./app.component.css"], | ||
}) | ||
export class AppComponent { | ||
versionDeno = Deno.version.deno; | ||
versionDeno = Deno.version.deno; | ||
} |
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,13 +1,11 @@ | ||
|
||
import { NgModule } from '@angular/core'; | ||
import { ServerModule } from '../mod.ts'; | ||
import { AppComponent } from './app.component.ts'; | ||
|
||
import { NgModule } from "@angular/core"; | ||
import { ServerModule } from "../mod.ts"; | ||
import { AppComponent } from "./app.component.ts"; | ||
|
||
@NgModule({ | ||
imports: [ServerModule], | ||
declarations: [AppComponent], | ||
bootstrap: [AppComponent], | ||
providers: [] | ||
imports: [ServerModule], | ||
declarations: [AppComponent], | ||
bootstrap: [AppComponent], | ||
providers: [], | ||
}) | ||
export class AppModule { } | ||
export class AppModule {} |
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,21 +1,24 @@ | ||
import { CompilerFactory, enableProdMode } from '@angular/core'; | ||
import { bootstrap, CommonEngine } from '../mod.ts'; | ||
import { AppModule } from './app.module.ts'; | ||
import { CompilerFactory, enableProdMode } from "@angular/core"; | ||
import { bootstrap, CommonEngine } from "../mod.ts"; | ||
import { AppModule } from "./app.module.ts"; | ||
|
||
import "../reflect.ts"; | ||
import 'zone.js'; | ||
import "zone.js"; | ||
|
||
const { readFile } = Deno; | ||
const decoder = new TextDecoder(); | ||
|
||
const indexHtml = decoder.decode(await readFile('index.html')); | ||
const indexHtml = decoder.decode(await readFile("index.html")); | ||
|
||
enableProdMode(); | ||
|
||
const ref: any = await bootstrap(AppModule, indexHtml); | ||
|
||
export const engine = new CommonEngine(ref.injector.get(CompilerFactory), AppModule); | ||
export const engine = new CommonEngine( | ||
ref.injector.get(CompilerFactory), | ||
AppModule, | ||
); | ||
|
||
// Render page | ||
|
||
console.log(await engine.render({ document: indexHtml, url: "/" })); | ||
console.log(await engine.render({ document: indexHtml, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | ||
|
||
import { CompilerFactory, enableProdMode } from '@angular/core'; | ||
import { bootstrap, CommonEngine } from '../mod.ts'; | ||
import { AppModule } from './app.module.ts'; | ||
import { CompilerFactory, enableProdMode } from "@angular/core"; | ||
import { bootstrap, CommonEngine } from "../mod.ts"; | ||
import { AppModule } from "./app.module.ts"; | ||
|
||
import "../reflect.ts"; | ||
import 'zone.js'; | ||
import "zone.js"; | ||
|
||
const { readFile } = Deno; | ||
const decoder = new TextDecoder(); | ||
|
||
const indexHtml = decoder.decode(await readFile('index.html')); | ||
const indexHtml = decoder.decode(await readFile("index.html")); | ||
|
||
enableProdMode(); | ||
|
||
const ref: any = await bootstrap(AppModule, indexHtml); | ||
|
||
export const engine = new CommonEngine(ref.injector.get(CompilerFactory), AppModule); | ||
export const engine = new CommonEngine( | ||
ref.injector.get(CompilerFactory), | ||
AppModule, | ||
); | ||
|
||
const s = serve({ port: 8000 }); | ||
|
||
for await (const req of s) { | ||
const body: string = await engine.render({ document: indexHtml, url: req.url }); | ||
const body: string = await engine.render( | ||
{ document: indexHtml, url: req.url }, | ||
); | ||
req.respond({ body }); | ||
} | ||
} |