MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / app

Function app

packages/angular/test/base/server.ts:11–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10// The Express app is exported so that it can be used by serverless Functions.
11export function app() {
12 const server = express();
13 const distFolder = join(process.cwd(), 'dist/test-app/browser');
14
15 // Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
16 server.engine('html', ngExpressEngine({
17 bootstrap: AppServerModule,
18 }));
19
20 server.set('view engine', 'html');
21 server.set('views', distFolder);
22
23 // Example Express Rest API endpoints
24 // app.get('/api/**', (req, res) => { });
25 // Serve static files from /browser
26 server.get('*.*', express.static(distFolder, {
27 maxAge: '1y'
28 }));
29
30 // All regular routes use the Universal engine
31 server.get('*', (req, res) => {
32 res.render('index', { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
33 });
34
35 return server;
36}
37
38function run() {
39 const port = process.env.PORT || 4000;

Callers 1

runFunction · 0.70

Calls 3

setMethod · 0.80
getMethod · 0.65
renderMethod · 0.45

Tested by

no test coverage detected