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