오범준·2020년 5월 23일

I decided to create a real website which is upgraded version of my first personal project

At this time, I am addressing server, backend using Node.js

To do

1. Registration Page

1_1) Loading HTML file

  • Loading Html page into Node.js Route
    want to bring below page

    to below route

1) register.html

the details you have to focus upon is

form class = "" method = "post" action = "route you want to use
  1. server_index.js

Point : you have to make both GET, POST route !!

1_2) Preventing errored response to server

I want to let page stay in current page, if error happens

but the problem is, even if the error happens, server receives the request from the client, and deal with it...

solution: change Form to Div

if you use the div, What I guess is, it sends request to server, regardless of the existence of error

So I used Div instead

1_3) Sending Post Info to Node.js and sending Response from Node.js

  • Problem : data 'role' is not sent to server

    as you see 'role' is not included...

it seems like ajax itself is working....but why only role is not sent to server??


I checked the User.js in order to check the usermodel schema

There was an error here, I had to revise "role" into "type"

1_4) Saving received data from client into Database

so it seems like, html file is appropriately sending the info to the server, but it seems like, it is not saving it into the DB....

Solution: I just had to make my code more complex

Dream of being "물빵개" ( Go abroad for Dance and Programming)

0개의 댓글