All files / src index.ts

26.66% Statements 4/15
14.28% Branches 1/7
0% Functions 0/2
26.66% Lines 4/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  1x 1x   1x                     1x                                    
 
import { ApplicationConfig, SawLoopbackApplication } from './application';
export * from './application';
 
export async function main(options: ApplicationConfig = {}) {
  const app = new SawLoopbackApplication(options);
  await app.boot();
  await app.start();
 
  const url = app.restServer.url;
  console.log(`Server is running at ${url}`);
  console.log(`Try ${url}/ping`);
 
  return app;
}
Iif (require.main === module) {
  // Run the application
  const configuration = {
    rest: {
      port: process.env.PORT ?? 5000,
      host: process.env.HOST,
      gracePeriodForClose: 5000, // 5 seconds
      openApiSpec: {
        setServersFromRequest: true,
      },
    },
  };
 
  main(configuration).catch(err => {
    console.error('Cannot start the application.', err);
    process.exit(1);
  });
}