Migrated the server.ts file
This commit is contained in:
parent
d66be23a7d
commit
316ddabc22
@ -25,8 +25,9 @@ const run = () =>
|
||||
app.listen(port, () => console.log(`LicenseAPI ${isDevelopment ? "development" : "production"} server started under port ${port}`));
|
||||
|
||||
// Connect to database
|
||||
mongoose.connect(MONGOOSE_STRING, (error: CallbackError) => {
|
||||
if (error) throw new Error(`Could not connect to database: ${error.message}`);
|
||||
mongoose.connect(MONGOOSE_STRING).then(() => {
|
||||
console.log(`Successfully connected to the database @${MONGOOSE_STRING.split("://")[1].split("/")[0]}`);
|
||||
run();
|
||||
}).catch((error: CallbackError) => {
|
||||
if (error) throw new Error(`Could not connect to database: ${error.message}`);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user