-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(create-analog): register router and initial client/server routes (#…
…152)
- Loading branch information
1 parent
5f11295
commit 11288d0
Showing
6 changed files
with
75 additions
and
73 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
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
62 changes: 62 additions & 0 deletions
62
packages/create-analog/template-angular-v14/src/app/routes/index.ts
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,62 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-home', | ||
standalone: true, | ||
template: ` | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src="/vite.svg" class="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://angular.io/" target="_blank"> | ||
<img | ||
alt="Angular Logo" | ||
class="logo angular" | ||
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==" | ||
/> | ||
</a> | ||
</div> | ||
<h1>Vite + Angular</h1> | ||
<div class="card"> | ||
<button type="button" (click)="increment()">Count {{ count }}</button> | ||
</div> | ||
<p> | ||
Check out | ||
<a href="https://github.com/analogjs/analog#readme" target="_blank" | ||
>Analog</a | ||
>, the fullstack meta-framework for Angular powered by Vite! | ||
</p> | ||
<p class="read-the-docs"> | ||
Click on the Vite and Angular logos to learn more. | ||
</p> | ||
`, | ||
styles: [ | ||
` | ||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.angular:hover { | ||
filter: drop-shadow(0 0 2em #42b883aa); | ||
} | ||
.read-the-docs { | ||
color: #888; | ||
} | ||
`, | ||
], | ||
}) | ||
export default class HomeComponent { | ||
count = 0; | ||
|
||
increment() { | ||
this.count++; | ||
} | ||
} |
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,11 +1,14 @@ | ||
import './polyfills'; | ||
import { enableProdMode } from '@angular/core'; | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { provideFileRouter } from '@analogjs/router'; | ||
|
||
import { AppComponent } from './app/app.component'; | ||
|
||
if (import.meta.env.PROD) { | ||
enableProdMode(); | ||
} | ||
|
||
bootstrapApplication(AppComponent); | ||
bootstrapApplication(AppComponent, { | ||
providers: [provideFileRouter()], | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/create-analog/template-angular-v14/src/server/routes/v1/hello.ts
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,3 @@ | ||
import { defineEventHandler } from 'h3'; | ||
|
||
export default defineEventHandler(() => ({ message: 'Hello World' })); |
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