DEV Community

Cover image for How to make e commerce website with HTML, CSS and JS part 2

How to make e commerce website with HTML, CSS and JS part 2

Modern Web on September 24, 2021

Hello, hope you'll are good. Today we'll do the second part of our fullstack e-com website series. In this part, you'll make a node server to run w...
Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Take it from somebody whos job it is to login an register and design user flows, I would recommend that you don't try to handle your own security or store users etc, get an IDP, even a free one like keycloak and use that. Your wallet / mind will thank you.

Collapse
 
fridaycandours profile image
Friday candour

What is idp

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀
Collapse
 
mnparekh83 profile image
mnparekh83

Hello - After following your 1st video tutorial, the 2nd part gives me error in npm start -
Image description

Kindly let me know.

Collapse
 
themodernweb profile image
Modern Web

Hey, make sure in your package.json file you have "start" : "nodemon server.js" then it should run.

Collapse
 
mcwolfmm profile image
mcwolfmm

something I did not like generating the token. and this is a critical moment.

if you plan to implement a real project with such an architecture, it is appropriate to consider working with JWT instead of using the current implementation.

Collapse
 
themodernweb profile image
Modern Web

Yeah I agree.I was just experimenting with token validation. Of course JWT is far or is the best solution for authentication☺️

Collapse
 
rumi1111 profile image
Rumi1111

Hello!

The Node.js thing does not work. Is there a way to implement it in Windows at all?

Or, more directly: I need a webshop with mysqli database. I am not familiar with what you use here. Is there a way to use your code directly with a "normal" database?

Thank you!

Collapse
 
rumi1111 profile image
Rumi1111

To be more concrete:

You write at the start of this part "Start with server, open the previous code folder in terminal or cmd prompt."

I don't understand that at all. What is "the previous code folder"? How can I open a whole folder in Terminal? How should I "start with server"? What server? Etc.

It seems that there is quite some important information missing.

Collapse
 
rumi1111 profile image
Rumi1111

It works now, at least locally. I still don't know how I get this online, but I will persist.
I hope I get it working! It's great that you offer this, thank you!

Collapse
 
themodernweb profile image
Modern Web

All codes are same, I wrote the blog in exact same order as the video. The only thing is, video it was line by line, and because of blog, I making it element by element, all the codes are same and you can follow any one.

Collapse
 
mcwolfmm profile image
mcwolfmm

and a little more criticism :) nowhere do you handle callback errors. this is a very bad practice.
be sure to check for an error first and only then continue processing the task. also, you can add another class of messages (besides alert) for example error to return in case of error

Collapse
 
themodernweb profile image
Modern Web

Thanks to pointing out the mistakes I'll make sure to handle error first.☺️

Collapse
 
fridaycandours profile image
Friday candour

Beautiful thanks

Collapse
 
vashuai profile image
VashuAI

// send data function
const sendData = (path, data) => {
fetch(path, {
method: 'post',
headers: new Headers({'Content-Type': 'application/json'}),
body: JSON.stringify(data)
}).then((res) => res.json()) //error in this line
.then(response => {
processData(response);
})

error-Uncaught (in promise) SyntaxError: Unexpected end of JSON input
at form.js:62:26

Collapse
 
optimbro profile image
Rahul

Keep it up :)

Collapse
 
arnob15490 profile image
arnob15490

getting this error on the login page while the email and password is correct.
form.js:82 Uncaught (in promise) ReferenceError: generateToken is not defined
at processData (form.js:82:5)
at form.js:72:9

Collapse
 
ribosomatic profile image
Jesus Liñan

Excelente! Muy buen post, eres muy hábil en el desarrollo web. Thanks for share your job.

Collapse
 
oeshi34 profile image
Info Comment hidden by post author - thread only accessible via permalink
OeshiRuíz

What is a 500 Internal Server Error? and how can solve this issues.

Kala jadu specialist

Collapse
 
jeffry2603 profile image
Jeffry Allan

Image description

Collapse
 
jeffry2603 profile image
Jeffry Allan • Edited

can u please tell me how to solve this problem login page while the email and password is correct.

Some comments have been hidden by the post's author - find out more