Moved the run method to the top
This commit is contained in:
parent
6f67028afb
commit
3ac0de90b6
@ -20,13 +20,13 @@ app.use("/v1/", v1Router);
|
|||||||
// Configure mongoose
|
// Configure mongoose
|
||||||
mongoose.set("strictQuery", false);
|
mongoose.set("strictQuery", false);
|
||||||
|
|
||||||
|
// Start the backend
|
||||||
|
const run = () =>
|
||||||
|
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, (error: CallbackError) => {
|
||||||
if (error) throw new Error(`Could not connect to database: ${error.message}`);
|
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();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the backend
|
|
||||||
const run = () =>
|
|
||||||
app.listen(port, () => console.log(`LicenseAPI ${isDevelopment ? "development" : "production"} server started under port ${port}`));
|
|
Loading…
x
Reference in New Issue
Block a user