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}`));
|
app.listen(port, () => console.log(`LicenseAPI ${isDevelopment ? "development" : "production"} server started under port ${port}`));
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
mongoose.connect(MONGOOSE_STRING, (error: CallbackError) => {
|
mongoose.connect(MONGOOSE_STRING).then(() => {
|
||||||
if (error) throw new Error(`Could not connect to database: ${error.message}`);
|
|
||||||
console.log(`Successfully connected to the database @${MONGOOSE_STRING.split("://")[1].split("/")[0]}`);
|
console.log(`Successfully connected to the database @${MONGOOSE_STRING.split("://")[1].split("/")[0]}`);
|
||||||
run();
|
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