Artinov / image-gallery-kramarmm

image-gallery-kramarmm created by GitHub Classroom
0 stars 0 forks source link

bodyParser #1

Open kramarmm opened 7 years ago

kramarmm commented 7 years ago

Hello, I have a problem with geting req.body. I leave a comments on this string. Maybe this is a wrong approach?

https://github.com/Artinov/image-gallery-kramarmm/blob/master/public/client.js#L20

eko24ive commented 7 years ago

Hi @kramarmm, let me check it

kramarmm commented 7 years ago

I replaced '/pictures' route into '/echo' and used url.parse for getting query string data.

And this is my client side code:

$.ajax({
        url: "/echo?message=" + lastImageIndex
eko24ive commented 7 years ago

@kramarmm could you tell me what you want to do ?

kramarmm commented 7 years ago

I thougth in this way:

1) at first reload send all images of /upload folder put attribute "data-i" for every image send

2) with uploading a new image $ajax will send to server number of last existing image (already uploaded and pasted into html)

The problem was in server responsing. It sent all images every time, even when I already have it.

Now it works, but I'm not sure that it was right desision.

eko24ive commented 7 years ago

Ok, now I see what you wanted. This is really great approach, although for myself I'd make call to get all images in uploads/ folder :) I'll see how I can help you with this one.