Code tested on here:

const express = require('express')
const app = express()
const MongoClient = require('mongodb').MongoClient
const assert = require('assert')

const url = 'mongodb://localhost:27017'
const dbName = 'dnd'
const client = new MongoClient(url)

app.use(express.urlencoded({extended: false}))
app.use(express.json())

client.connect((err) => {
    assert.strictEqual(null, err)
    console.log('Connected to server')
    const db = client.db(dbName)
    client.close()
})

app.get('/', (req, res) => {
    res.status(200).json({msg: 'Connected'})
})

app.listen(3000, (req, res) => {
    console.log("Server up and running!")
})

What it does

Sets up basic Express server and connects to MongoClient

How we built it

Tabnine/Express

Challenges we ran into

None!

Accomplishments that we're proud of

It was so fast to type!

What we learned

That Tabnine is really an amazing feature on my VS Code now.

Built With

Share this project:

Updates