I am currently working on an ExpressJS project that was created using the Express generator. My goal is to integrate TypeORM into this project, but I am facing some challenges in achieving that.
After attempting to modify the /bin/www
file with the following code snippet:
typeorm.createConnection().then((connection) => {
/**
* Create HTTP server.
*/
server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
}).catch(err => {
console.log(err);
});
I encountered an issue where I received a "default connection was not found" error whenever I tried to use TypeORM within an ExpressJS route.