I currently have a barebones angular application, where I am trying to serve the bundled files from build of my angular client app through my express server.
I am using ng-build to build the angular code and copy the contents of the dist folder into the dist folder of my server. It looks like the following
When I bootup the server, I can render the index.html but see the following in my console
GET /inline.bundle.js.map 404 8.875 ms - 159
GET /polyfills.bundle.js.map 404 3.486 ms - 162
GET /styles.bundle.js.map 404 2.860 ms - 159
GET /vendor.bundle.js.map 404 2.695 ms - 159
GET /main.bundle.js.map 404 2.956 ms - 157
To hook up the client to server, I have the following in app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { APP_BASE_HREF } from '@angular/common';
import { routing } from './app.routing';
import { AppComponent } from './app.component';
import {QueuedService} from "./queued.service";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [{provide: APP_BASE_HREF, useValue:'/'}, QueuedService],
bootstrap: [AppComponent]
})
export class AppModule { }
My queued.service.ts has the following
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class QueuedService {
host:string = "http://localhost:8080";
constructor(private http: Http){}
}
At the moment, I am not sure if I am bridging the client and server properly.
via RRP
No comments:
Post a Comment