jaseew01 / multi-user-file-manager

0 stars 0 forks source link

Start work on a documentation file for your API #7

Open skiadas opened 10 years ago

skiadas commented 10 years ago

Things to work on (where do they fit into the "profile"):

skiadas commented 10 years ago

A good place to start is following the steps for designing an API outlined in chapter 9. After reading the chapter and writing a summary of the steps, apply those steps to your API.

jaseew01 commented 10 years ago

What is the difference between a safe and unsafe state transition? I remember the RESTful web api's book talking about it, I just don't remember their meanings.

skiadas commented 10 years ago

It's on page 128 I believe, but that's in relation to requests. So if I do say a GET request, I expect that this is not going to change things on the server. It might give me some information, may even download a file or something, but it is not going to delete or change something on the server. So I could do this get request as many times as I like without worrying about the effect it will have on the server.

jaseew01 commented 10 years ago

I am not sure what to put into the action attribute on the form that I created. I am trying to see what the POST will look like with a file attached to it. You can see what I have so far, the file is attached to the latest commit. Usually you put the name of a file on the server to handle the POST, should I be doing the same thing here?

skiadas commented 9 years ago

So, the "action" is always just the URL to submit to. It can be relative if this webpage would be served from the same address, or you can use an absolute path, which may be something like "127.0.0.1:8000/files", assuming you have your server listen to port 8000. Or if your server itself had served that page, a simple "/files" would suffice.

So this has nothing to do with the actual file you are trying to upload, I don't think, or the fact that you are uploading a file at all. It is just the URL that is meant to handle this request.

So yeah, there aren't really distinct "files" on the server to be handling these requests, your node program is the server, and no matter what you put there (as long as the ip address part matches the server) it is your server program that will be handling that request. The rest of the action field/url tells your server which router to take.

jaseew01 commented 9 years ago

Okay, so I put "localhost:8080" into the action attribute for the form. I then ran NodeServer.js and the post did not hit any of the methods. My browser says that the address was not understood.

skiadas commented 9 years ago

Can you hit your methods in any way from the browser? What would the address bar look like for something that works?

jaseew01 commented 9 years ago

I am able to hit the initial GET method with localhost:8080 from the browser.

jaseew01 commented 9 years ago

Just not the POST for some reason. My second to last commit has the most up-to-date files.