Preview:
const express = require("express");
const app = express();
const cors = require("cors");

require("dotenv").config({path:"./config.env"});

const port = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());
app.use(require("./routes/record"));

//get driver connection
const dbo = require("./db/conn");

app.listen(port,()=>{
    // perform a database connection when server starts
    dbo.connectToServer(function (err) {
        if(err) console.error(err);
    })
    console.log(`Server is running on port: ${port}`);
});
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter