Get your own Node server
// src/application.ts
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
import {HelloController} from './controllers/hello.controller';

export class MyApplication extends RestApplication {
  constructor(options: ApplicationConfig = {}) {
    super(options);
    
    this.controller(HelloController);
    
    this.bind('port').to(8080);
    this.bind('host').to('localhost');
    
    this.projectRoot = __dirname;
  }
}

// src/controllers/hello.controller.ts
import {get} from '@loopback/rest';

export class HelloController {
  @get('/hello')
  hello(): object {
    return {
      greeting: 'Hello World from LoopBack!',
      framework: 'LoopBack 4',
      timestamp: new Date().toISOString()
    };
  }

  @get('/')
  root(): string {
    return 'Hello World from LoopBack Root!';
  }
}

// src/index.ts
import {ApplicationConfig} from '@loopback/core';
import {MyApplication} from './application';

export async function main(options: ApplicationConfig = {}) {
  const app = new MyApplication(options);
  await app.boot();
  await app.start();

  const url = app.restServer.url;
  console.log(`LoopBack server is running at ${url}`);

  return app;
}

if (require.main === module) {
  main().catch(err => {
    console.error('Cannot start the application.', err);
    process.exit(1);
  });
}

              
http://localhost:8080