nodejs post method not getting called
I found my question was asked a year ago here app.post() not working with Express but the code written there is outdated (the way bodyparser was added doesn't work anymore as well as function mentioned below) plus the asker never chose an answer so the question was never solved.
Here's my code
const express = require("express");
const db = require("mysql");
const app = express();
const bodyParser = require("body-parser");
const multer = require("multer"); // v1.0.5
const upload = multer(); // for parsing multipart/form-data
const http = require("http");
const path = require("path");
app.set("view engine", "jade");
app.set("views", path.join(__dirname));
console.log("before");
app.listen(8000, () => {
console.log("Server started!");
console.log("within");
});
console.log("after");
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post("/", function(req, res) {
console.log("hit here in post");
res.render("index.jade", {});
console.log("hit here in post");
res.json({ name: "John" });
res.status(500).json({ error: "message" });
res.end();
});
app.get("/", function(req, res) {
res.render("index.jade", {});
console.log("hit here in get");
console.log(req.body);
});
Here's the output.
before
after
Server started!
within
hit here in get
{}
I even tried to wrap the app sets and uses in app.configure like the asker of the other question to see if that was the issue but that configure function doesn't seem to exist anymore because I got an error about it.
Also I should probably note. My routing here is correct. I haven't made a views subfolder yet so that's why I have it written as it is.
Update
I think I may have spotted the issue but I don't understand why it's occurring. In the network tab of the browser I see that GET is getting 404 error because of a favicon.ico request but I don't understand where that request is coming from. I've seen the serve-favicon npm module to support it but didn't want to added because I never intended to add a favicon image to my server. I don't even understand how that would work.
Reply to last comment by James
What do you mean by I configure the middleware after it has started? Are you referring to the fact that the post method is written after port listening has started? Also if that's the reason why post isn't executing how come the get method executes regardless of that? I'm not holding back any server code aside from code I currently have commented out for the moment but that code I posted is my main index.js file and it's the only file I modified from the standard npm init project. I haven't setup any routes because I don't see the need to do so (even when I add react since my project is simple in concept of communication between reactjs, nodejs and a database "hence my frustration") which is why I'm trying to have get and post only access the root directory.
node.js
|
show 1 more comment
I found my question was asked a year ago here app.post() not working with Express but the code written there is outdated (the way bodyparser was added doesn't work anymore as well as function mentioned below) plus the asker never chose an answer so the question was never solved.
Here's my code
const express = require("express");
const db = require("mysql");
const app = express();
const bodyParser = require("body-parser");
const multer = require("multer"); // v1.0.5
const upload = multer(); // for parsing multipart/form-data
const http = require("http");
const path = require("path");
app.set("view engine", "jade");
app.set("views", path.join(__dirname));
console.log("before");
app.listen(8000, () => {
console.log("Server started!");
console.log("within");
});
console.log("after");
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post("/", function(req, res) {
console.log("hit here in post");
res.render("index.jade", {});
console.log("hit here in post");
res.json({ name: "John" });
res.status(500).json({ error: "message" });
res.end();
});
app.get("/", function(req, res) {
res.render("index.jade", {});
console.log("hit here in get");
console.log(req.body);
});
Here's the output.
before
after
Server started!
within
hit here in get
{}
I even tried to wrap the app sets and uses in app.configure like the asker of the other question to see if that was the issue but that configure function doesn't seem to exist anymore because I got an error about it.
Also I should probably note. My routing here is correct. I haven't made a views subfolder yet so that's why I have it written as it is.
Update
I think I may have spotted the issue but I don't understand why it's occurring. In the network tab of the browser I see that GET is getting 404 error because of a favicon.ico request but I don't understand where that request is coming from. I've seen the serve-favicon npm module to support it but didn't want to added because I never intended to add a favicon image to my server. I don't even understand how that would work.
Reply to last comment by James
What do you mean by I configure the middleware after it has started? Are you referring to the fact that the post method is written after port listening has started? Also if that's the reason why post isn't executing how come the get method executes regardless of that? I'm not holding back any server code aside from code I currently have commented out for the moment but that code I posted is my main index.js file and it's the only file I modified from the standard npm init project. I haven't setup any routes because I don't see the need to do so (even when I add react since my project is simple in concept of communication between reactjs, nodejs and a database "hence my frustration") which is why I'm trying to have get and post only access the root directory.
node.js
1
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to500on purpose.
– Dinesh Pandiyan
Nov 20 '18 at 1:24
It seems that you areGETing notPOSTing
– Ricky Mo
Nov 20 '18 at 2:02
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26
|
show 1 more comment
I found my question was asked a year ago here app.post() not working with Express but the code written there is outdated (the way bodyparser was added doesn't work anymore as well as function mentioned below) plus the asker never chose an answer so the question was never solved.
Here's my code
const express = require("express");
const db = require("mysql");
const app = express();
const bodyParser = require("body-parser");
const multer = require("multer"); // v1.0.5
const upload = multer(); // for parsing multipart/form-data
const http = require("http");
const path = require("path");
app.set("view engine", "jade");
app.set("views", path.join(__dirname));
console.log("before");
app.listen(8000, () => {
console.log("Server started!");
console.log("within");
});
console.log("after");
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post("/", function(req, res) {
console.log("hit here in post");
res.render("index.jade", {});
console.log("hit here in post");
res.json({ name: "John" });
res.status(500).json({ error: "message" });
res.end();
});
app.get("/", function(req, res) {
res.render("index.jade", {});
console.log("hit here in get");
console.log(req.body);
});
Here's the output.
before
after
Server started!
within
hit here in get
{}
I even tried to wrap the app sets and uses in app.configure like the asker of the other question to see if that was the issue but that configure function doesn't seem to exist anymore because I got an error about it.
Also I should probably note. My routing here is correct. I haven't made a views subfolder yet so that's why I have it written as it is.
Update
I think I may have spotted the issue but I don't understand why it's occurring. In the network tab of the browser I see that GET is getting 404 error because of a favicon.ico request but I don't understand where that request is coming from. I've seen the serve-favicon npm module to support it but didn't want to added because I never intended to add a favicon image to my server. I don't even understand how that would work.
Reply to last comment by James
What do you mean by I configure the middleware after it has started? Are you referring to the fact that the post method is written after port listening has started? Also if that's the reason why post isn't executing how come the get method executes regardless of that? I'm not holding back any server code aside from code I currently have commented out for the moment but that code I posted is my main index.js file and it's the only file I modified from the standard npm init project. I haven't setup any routes because I don't see the need to do so (even when I add react since my project is simple in concept of communication between reactjs, nodejs and a database "hence my frustration") which is why I'm trying to have get and post only access the root directory.
node.js
I found my question was asked a year ago here app.post() not working with Express but the code written there is outdated (the way bodyparser was added doesn't work anymore as well as function mentioned below) plus the asker never chose an answer so the question was never solved.
Here's my code
const express = require("express");
const db = require("mysql");
const app = express();
const bodyParser = require("body-parser");
const multer = require("multer"); // v1.0.5
const upload = multer(); // for parsing multipart/form-data
const http = require("http");
const path = require("path");
app.set("view engine", "jade");
app.set("views", path.join(__dirname));
console.log("before");
app.listen(8000, () => {
console.log("Server started!");
console.log("within");
});
console.log("after");
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post("/", function(req, res) {
console.log("hit here in post");
res.render("index.jade", {});
console.log("hit here in post");
res.json({ name: "John" });
res.status(500).json({ error: "message" });
res.end();
});
app.get("/", function(req, res) {
res.render("index.jade", {});
console.log("hit here in get");
console.log(req.body);
});
Here's the output.
before
after
Server started!
within
hit here in get
{}
I even tried to wrap the app sets and uses in app.configure like the asker of the other question to see if that was the issue but that configure function doesn't seem to exist anymore because I got an error about it.
Also I should probably note. My routing here is correct. I haven't made a views subfolder yet so that's why I have it written as it is.
Update
I think I may have spotted the issue but I don't understand why it's occurring. In the network tab of the browser I see that GET is getting 404 error because of a favicon.ico request but I don't understand where that request is coming from. I've seen the serve-favicon npm module to support it but didn't want to added because I never intended to add a favicon image to my server. I don't even understand how that would work.
Reply to last comment by James
What do you mean by I configure the middleware after it has started? Are you referring to the fact that the post method is written after port listening has started? Also if that's the reason why post isn't executing how come the get method executes regardless of that? I'm not holding back any server code aside from code I currently have commented out for the moment but that code I posted is my main index.js file and it's the only file I modified from the standard npm init project. I haven't setup any routes because I don't see the need to do so (even when I add react since my project is simple in concept of communication between reactjs, nodejs and a database "hence my frustration") which is why I'm trying to have get and post only access the root directory.
node.js
node.js
edited Nov 22 '18 at 0:34
codehelp4
asked Nov 20 '18 at 1:10
codehelp4codehelp4
739
739
1
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to500on purpose.
– Dinesh Pandiyan
Nov 20 '18 at 1:24
It seems that you areGETing notPOSTing
– Ricky Mo
Nov 20 '18 at 2:02
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26
|
show 1 more comment
1
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to500on purpose.
– Dinesh Pandiyan
Nov 20 '18 at 1:24
It seems that you areGETing notPOSTing
– Ricky Mo
Nov 20 '18 at 2:02
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26
1
1
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to
500 on purpose.– Dinesh Pandiyan
Nov 20 '18 at 1:24
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to
500 on purpose.– Dinesh Pandiyan
Nov 20 '18 at 1:24
It seems that you are
GETing not POSTing– Ricky Mo
Nov 20 '18 at 2:02
It seems that you are
GETing not POSTing– Ricky Mo
Nov 20 '18 at 2:02
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26
|
show 1 more comment
1 Answer
1
active
oldest
votes
favicon is automatically requested by the browser. it is the icon used in the browser tab or url address bar
Add this, before app.get():
app.all('/', function(req, res, next) {
console.log({method: req.method, url: req.url});
next();
});
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384834%2fnodejs-post-method-not-getting-called%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
favicon is automatically requested by the browser. it is the icon used in the browser tab or url address bar
Add this, before app.get():
app.all('/', function(req, res, next) {
console.log({method: req.method, url: req.url});
next();
});
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
add a comment |
favicon is automatically requested by the browser. it is the icon used in the browser tab or url address bar
Add this, before app.get():
app.all('/', function(req, res, next) {
console.log({method: req.method, url: req.url});
next();
});
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
add a comment |
favicon is automatically requested by the browser. it is the icon used in the browser tab or url address bar
Add this, before app.get():
app.all('/', function(req, res, next) {
console.log({method: req.method, url: req.url});
next();
});
favicon is automatically requested by the browser. it is the icon used in the browser tab or url address bar
Add this, before app.get():
app.all('/', function(req, res, next) {
console.log({method: req.method, url: req.url});
next();
});
edited Nov 20 '18 at 23:44
answered Nov 20 '18 at 19:41
Jeff LoweryJeff Lowery
1,0561527
1,0561527
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
add a comment |
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
Ok I'll add it and see if that fixes everything but I'm curious why does the browser make it a requirement to have when I'm still in the development process of the server?
– codehelp4
Nov 20 '18 at 19:46
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
It's an old standard. Browsers will make an HTTP request for it regardless of server. It is not required to have it, but it would explain why you're seeing that GET request.
– Jeff Lowery
Nov 20 '18 at 19:48
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
Oh ok then I assume that wouldn't be the cause of my main issue. Any idea why my post method isn't executing? (or at least doesn't appear to be since none of the log message I wrote in it are printing and the get method isn't getting the data I'm trying to post)
– codehelp4
Nov 20 '18 at 19:51
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
You can add the following: app.all('/', function(req, res) { console.log(req.type, req.location); // from memory, probably wrong next() });
– Jeff Lowery
Nov 20 '18 at 19:59
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
I tried it but it didn't print anything to the output when I put it at the buttom and when I put it right below the listen function it just added a line to the output saying undefined twice.
– codehelp4
Nov 20 '18 at 20:37
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384834%2fnodejs-post-method-not-getting-called%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
How are you making the request to the server?
– user2263572
Nov 20 '18 at 1:13
How did you conclude that the method was not invoked? no console logs or error in response? I see that response status is set to
500on purpose.– Dinesh Pandiyan
Nov 20 '18 at 1:24
It seems that you are
GETing notPOSTing– Ricky Mo
Nov 20 '18 at 2:02
@user2263572 What do you mean? I eventually plan to have the server interact with React but at the moment I'm just trying to have the server function but itself hence why I added the jade engine.
– codehelp4
Nov 20 '18 at 5:11
@DineshPandiyan I copied that from somewhere. I thought it was a way of catching the error from the http request if it did hit an error but if I'm just triggering it I'll get rid of it. Thanks. Also yes I concluded that the post method doesn't execute because none of the console.log messages print in the terminal nor web console.
– codehelp4
Nov 20 '18 at 6:26