Answer the question
In order to leave comments, you need to log in
How to set up a web server to respond to post requests?
I'm trying to make a request to a web server. When the code is hosted on localhost, the requests are processed and the server sends a response. When I upload the code to a remote machine with debian 9 OS, requests are not processed, although there is a ping to the server. I'm testing through the Postman program, postman reports that it could not receive a response.
const http = require('http'),
mysql = require('mysql'),
express = require('express'),
options = require('./config.js'),
router = express.Router();
let con = mysql.createConnection(options);
router.post('/update/:id', function(req, res){
(async()=> {
let schoolNumber = req.params.id; //выборка данных из школы
let obj = {};
try { //сохраняем данные в свойства объекта
obj.subject_schoolboy = await sqlQuery( //выборка subject у шк
"SELECT DISTINCT idsubject FROM subject "+
"INNER JOIN schoolboy ON subject.idsubject=schoolboy.idschoolboy "+
"INNER JOIN school ON schoolboy.school=school.idschool WHERE school.shortName="+schoolNumber+" AND schoolboy.actuality=1" );
obj.subject_teacher = await sqlQuery( //выборка subject у уч
"SELECT DISTINCT idsubject FROM subject "+
"INNER JOIN teacher ON subject.idsubject=teacher.idteacher "+
"INNER JOIN school ON teacher.school=school.idschool WHERE school.shortName="+schoolNumber+" AND teacher.actuality=1" );
...............................................................................................................................................................
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question