@willgmbr
Bem vindo ao Semantic Versioning!
// utils.js
export function makeMeASandwich() {
return 'make sandwich: operation not permitted';
}
export function sudoMakeMeASandwich() {
return 'one open faced club sandwich coming right up';
}
// index.js
import { sudoMakeMeASandwich } from './utils.js';
sudoMakeMeASandwich();
ng build --prod
// src/app/app-routing.module.ts
import { RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
export const routing = RouterModule.forRoot([
{ path: '', component: HomeComponent },
{ path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule' },
{ path: '**', redirectTo: '' }
]);
> ng generate universal <name>
> ng build --app=<name>
// index.server.ts
// Express server
const app = express();
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
}));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req });
});
> ng new --service-worker
> ng generate app-shell