Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
irustm committed Sep 9, 2020
1 parent f15599c commit eff3f62
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
10 changes: 5 additions & 5 deletions example/app.component.ts
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;
}
18 changes: 8 additions & 10 deletions example/app.module.ts
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 {}
17 changes: 10 additions & 7 deletions example/main.ts
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: "/" }));
21 changes: 13 additions & 8 deletions example/server.ts
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 });
}
}

0 comments on commit eff3f62

Please sign in to comment.