randydev commited on
Commit
aa680e5
·
verified ·
1 Parent(s): fb013a6

Create lifestyle.js

Browse files
Files changed (1) hide show
  1. lifestyle.js +23 -0
lifestyle.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Database = require('./database.js');
2
+ const port = 7860
3
+
4
+ const startup = async () => {
5
+ try {
6
+ const dbClient = new Database("AkenoXJs", "FastJsAPI");
7
+ console.log("Starting application...");
8
+ await dbClient.connect();
9
+ console.log("MongoDB connected successfully.");
10
+ } catch (error) {
11
+ console.error("Error during startup:", error.message);
12
+ process.exit(1);
13
+ }
14
+ };
15
+
16
+ const startServer = async (app) => {
17
+ await startup();
18
+ app.listen(port, () => {
19
+ console.log(`Server running on http://localhost:${port}`);
20
+ });
21
+ };
22
+
23
+ module.exports = { startServer };