Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angularjs NodeJS server performs POST request, but returns HTTPErrorResponse

router.post('/', async (req,res) => {
        const body = req.body;
        await database.execute(`
            INSERT INTO Post (
                title,
                body,
                date_added
            ) VALUES (
                @title,
                @body,
                NOW()
            )
            `, {
                title: body.title,
                body: body.body,
            })
        res.end({}) // returns successfully, no error
    })
 
PREVIOUS NEXT
Tagged: #angularjs #NodeJS #server #performs #POST #returns #HTTPErrorResponse
ADD COMMENT
Topic
Name
3+4 =