import * as path from 'path' ; import fastify from 'fastify' ; import { createConnection } from 'typeorm' ; import { bootstrap } from '@fastify-resty/core' ; import typeorm from '@fastify-resty/typeorm' ; async function main ( ) { const app = fastify ( ) ; const connection = await createConnection ( ) ; app . register ( typeorm , { connection } ) ; app . register ( bootstrap , { entry : path . resolve ( __dirname , 'api' ) } ) ; app . listen ( 8080 , ( err , address ) => { if ( err ) { console . error ( err ) ; process . exit ( 1 ) ; } console . log ( `Server is listening on ${ address }` ) ; console . log ( app . printRoutes ( ) ) ; } ) ; } main ( ) ;