I am trying to create a basic webpage that connects to my MongoDB cluster and adds to the webpage based on the return. The actual scripting hasn't been an issue, but for the life of me I can't understand how to properly load in the library for it to work. I am new to web development, but I also might just be dense. Thanks for your help!
My HTML is like this:
<!DOCTYPE html>
<html lang="en">
<head>
<title>MRE</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<div class="container">
<div>Header</div>
</div>
</body>
</html>
and with the line: import { MongoClient } from 'mongodb'
I get the error:
Uncaught SyntaxError: Cannot use import statement outside a module (at script.js:1:1)