Status 201 in fetch
12:52 01 Aug 2021

I've the below JS code, that is returning status 201, enter image description here

I'm working it with a local server, that is working correctly once I checked it at thunder client as shown:

enter image description here

My code is:

async function send(params) {
    var path = document.querySelector('#path');
    var skills = document.querySelector('#skills');
    var skillsList = skills.value
    skillsList = skillsList.replace(/\n\r?/g, '|');
    const dataToSend = JSON.stringify({"path": path.value, "skills": skillsList});
    console.log(dataToSend);
    let dataReceived = ""; 
    fetch("http://localhost:3000/getSkills", {
        credentials: "same-origin",
        mode: "cors",
        method: "post",
        headers: { "Content-Type": "application/json" },
        body: dataToSend
    }).then(resp => {
        if (resp.status === 200) {
            return resp.json();
        } else {
            console.log("Status: " + resp.status)
            return Promise.reject("server")
        }
    }).then(dataJson => {
        dataReceived = JSON.parse(dataJson)
        console.log(`Received: ${dataReceived}`)
    }).catch(err => {
        if (err === "server") return
        console.log(err)
    }) 
}

Why I'm getting 201, not the returned JSON object as expected, and as shown at thunder client?

javascript