csc309-team58/sports-matcher/server/middleware/database.js
Harrison Deng ba566040b1 Rewrite phase 1.
Started improved client code structure.

Implemented session based authentication serverside.

Implemented user, match, and sport database models serverside.

Implemented Controllers for variety of C and R operations of CRUD.
2022-04-04 20:15:43 -05:00

9 lines
248 B
JavaScript

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();
}
}