csc309-team58/sports-matcher/server/middleware/database.js

9 lines
248 B
JavaScript
Raw Permalink Normal View History

import mongoose from "mongoose";
export function needDatabase(res, req, next) {
if (mongoose.connection.readyState != 1) {
res.status(500).send("Internal server error: Database connection faulty.");
} else {
next();
}
}