0 votes
1 view
in Web Technology by (19.2k points)

I'm very newbie to nodejs.I'm practicing an Nodejs with express in MVC architecture with MySQL. All things are working fine, but I wonder why this application working POST request only once after server start.

This is my Controller

const IncData = require("../../models/Accounts_Models/Income_Model");

module.exports = {


        IncData.m_add_inc_head(req.con , req.body, function (err)







My Model


    m_add_inc_head: function (con,data,callback){

        con.query('CALL Create_Income_Head (?,?,?,?,?,?)',[data.income_category,data.description,1,0,'',''],callback);



My Router

const express = require('express');

const router = express.Router();

const income = require("../../controllers/Accounts_Controllers/Income_Controller");


module.exports = router;

Someone please explain what went wrong in this code?

1 Answer

0 votes
by (25.1k points)

In your request you don't have successful response (so after request client side waits response but it's only for errors), try:

module.exports = {

    create_income_head(req,res) {

        IncData.m_add_inc_head(req.con , req.body, function (err) {

            if(err) {



            // or just res.send('some message');

            // or res.status(201).end();

            res.status(201).json({ success: true });




Welcome to Intellipaat Community. Get your technical queries answered by top developers !