Relative beginner here, I'm having issues with express and async/await functions, with an unhandled promise rejection.
Here is my code on the client side, grabbing username and password from a page and sending it over.
async function signIn() {
let username = document.getElementById('username').value
let password = document.getElementById('password').value
let url = '/api/login'
url += '?username=' + username
url += '&password=' + password
const response = await fetch(url)
console.log(response)
}
and here is my corresponding server function:
app.post('/api/login', function (req, res) {
console.log("I'll log you in")
}
There's some code which does actually log in after that but that's all I need to create the error that I'm having.
This is the error I get in safari 11.03:
Unhandled Promise Rejection: TypeError: Type error
And this is the error in firefox 59.0.1:
TypeError: NetworkError when attempting to fetch resource.