So my issue is that the program obviously isn't working, but it also isn't crashing. It's like it never executes the try or catch.
const express = require("express"),
app = express(),
sql = require("mssql"),
port = 5000 || process.env.PORT,
bodyParser = require("body-parser"),
routerBoi = express.Router();
const sqlConfig = {
user: "sa",
password: "@Strongman105",
server: "DESKTOP-RVS5F2QHSTESTSERVER",
database: "master"
};
async () => {
try {
// make sure that any items are correctly URL encoded in the connection string
await sql.connect(sqlConfig);
const result = await sql.query(`select * from Users`);
console.log(result);
} catch (err) {
console.log(err);
}
};
// console.log that your server is up and running
app.listen(port, () => console.log(`Listening on port ${port}`));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
The entirety of my output is "Listening on port 5000".
What am I doing wrong here?