Frontend with backend, help

I have made effort to connect my [html frontend] with [nodejs backend], but to no avail.
I have my html signup/login served on express and my router function which connect front end with backend also served on express server, but when i signup/login I get a message CAN NOT POST SIGNUP.
I my suppose to post again the user input on the server.js, after i have already posted it in a router function???
please what should i do. the link is Glitch fee free to commet, edit or suggest. thanks

You’re almost there!

Replace action="/login" with action="/user/login" because app.use("/user", user); prefixes all your post request handling with /user if you don’t want the prefixing remove "/user",


thanks a lot, am gonna do that and give you feed back

this is the message i got
** Site didn’t respond

Something in the code caused it to close the connection before providing a response.

If this is your project please visit us at for assistance.**
//But it seems to connect

From my vantage point I hate to say it but you’re not close. Even if you somehow managed to get this example to work. You have really chosen a complex project to start with. You’re using Express, Mongo, mongoose, jwt, bcrypt, v-response and more. And you seem new to JavaScript.

Don’t you think it might be a good idea to write little apps that exercised the various parts before you tried one that includes them all?

It only took a few minutes to notice the following:

//check email from database
let user = await User.findOne({ email: });
if (User) {

user is lowercase I don’t imagine you want to test User.

if (!user) {
.json({ mssge: mv.AppResponse(false, 454, “account not found”) });

.staus isn’t a method, I don’t know what you gain by adding v-response into the mix as well.

let compareEmail = bcrypt.comparep;
} catch (e) {
mv.log(“error login”);

Does bcrypt work like that? bcrypt.comparep with no parameters at all?

You need to recognize that you are not “a few people poking into your code to solve one error” away from this working.

I sincerely hope this helps but you need to write a “hello world” app for express, mongo, bcrypt and whatever else you are using so you have confidence in how they work.

1 Like

I appreciate, it quite true that i have to combine two projects, following different format to get to this point, as such mixing up thing. i hope to research more and have a cleaner one next time. again writing hello node has been my time invested little project and i choose to go on this…
thanks ones again for been nice and sincere, tleylan.

Not a problem you need to keep trying just make the projects a little more “bite size”.

1 Like

Good evening tleylan, I effect all the errors you suggested, and i saw that it was network that lead to such mistakes. why?? each time the network is not strong and i completed a code loading the page back will omit some of the changes or code. why i my explaining, cause the errors were the sign of some one who never start coding to have make such mistakes.
Any ways i have made the correction and am pleading that you over see the project ones more cause, now its not displaying any error from the console or any where but just not responding .

From what I can tell after a quick look, you fixed the typos but I have no idea about the logic.

I tried to register a bogus name and nothing happened eventually the site timed out and I got a “Site didn’t respond” message from glitch. You don’t look to be returning anything to the browser in some cases, anywhere you return an mv.log() call for instance. You need to respond to the client one way or another.

There is some “funny code” as well in your userval.js file. The definition is
const valUserAccount = {
validateAccount(userdata) {

you export module.exports = valUserAccount; which forces you to use the following syntax

You only need to export one function probably named validateUserAccount or some such.

I would separate your into several functions that calls in turn. You can’t test the user validation, the db findOne, the bcrypt or the jwt calls independent of your app. The only way you can test these is to try to signup. By separating them you could try doing db lookups or validations with some simple tests. You are stuck doing all or nothing processing which makes it hard to find a small error.

Finally test your database stuff completely independent of the the signup process. Have more buttons on your index page that tests the various parts. You turn those buttons off when they work, you make them visible again if something breaks to help you find the issue.

I can’t do anything more you need to develop a method for breaking big problems into smaller problems that you can solve. Once it is working this doesn’t mean your problems are over, they will have just started. So make it into something testable from the start.

1 Like

Thanks, am glad to have find you during my age.