So I am making a webpage with a form which when submitted should post the user input to a Notion database. Both parts work separately, but I'm having a hard time finding information about how to get the API handling node and the HTML+CSS+JS site to communicate.
//API Handler
const dotenv = require('dotenv').config();
const {Client} = require('@notionhq/client');
const notion = new Client({ auth: process.env.NOTION_KEY });
database_id = process.env.NOTION_DATABASE_ID;
let createNewDayNotion = function(valsFromUser){...}
The webpage is very simple pure html+css+js and the calling action is an onmousemove="getUserInputData()"
Both parts work, the problem is that I don't understand how to use the function in the API node in the main web JS code. I understand that require does not work on client side, because if I try to implement the API code in the same VSCode workspace as the frontend it gives me require is not defined.
As you may notice, I'm a complete beginner to web site design and I'm really just looking for the easiest way for me to get the webpage and the node to communicate.
I was hoping to not really need a back end, since the page only communicates with the notion API, is this possible? Or is it just a confused question?