From 3ac0de90b6ab4e8cfb98e102ed916246e00b738d Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 15 Jan 2023 01:52:54 +0100 Subject: [PATCH] Moved the run method to the top --- src/server.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server.ts b/src/server.ts index 12dff3c..50daf6e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -20,13 +20,13 @@ app.use("/v1/", v1Router); // Configure mongoose 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 mongoose.connect(MONGOOSE_STRING, (error: CallbackError) => { 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]}`); run(); -}); - -// Start the backend -const run = () => - app.listen(port, () => console.log(`LicenseAPI ${isDevelopment ? "development" : "production"} server started under port ${port}`)); \ No newline at end of file +}); \ No newline at end of file