type-graphql-dataloader icon indicating copy to clipboard operation
type-graphql-dataloader copied to clipboard

getConnection from TypeORM is deprecated -- update README to use DataSource instead

Open thatguyintech opened this issue 1 year ago • 1 comments

getConnection is now deprecated in Typeorm

So the README getting started instructions should do something like this instead:

export const initializeDataSource = async () => {
    const options = {...};
    return new DataSource(options);
}

const initializeApolloServer = async() => {
    const dataSource = await initializeDataSource();
    if (dataSource.isInitialized === false) {
        logger.debug("Initializing data source...");
        await dataSource.initialize();
    }
    return new ApolloServer({
        schema,
        plugins: [ ApolloServerLoaderPlugin({ typeormGetConnection: dataSource }),
    });
}

thatguyintech avatar Jun 21 '23 05:06 thatguyintech