简体   繁体   中英

405 Error From Slim PHP while using Backbone JS with MAMP

I'm new to backbonejs and slim but I'm diving right in.

my backbone code is fine, and it works when I use localstorage, but I want to use a mysql back end. I did some homework and found the SLIM framework. Looked pretty cool, RESTful, etc. I've seen that its been used a bunch with backbone.

backbone gets information from the file fine.

When backbone requests my file with the PUT, I get: POST http://localhost:8888/lifeconsole/src/server/ 405 (Method Not Allowed).

I've seen this question

I replaced the suggested section of SLIM code in the answers section.

I also modified my httpd.conf file to allow .htaccess files in local directories. I ensured that I had the .htaccess file that ships with SLIM in the directory with my SLIM files. I've been doing a lot of reading about apache configuration and feel a little over my head. Any suggestions would be fantastic!

I figured it out! I was confused about a basic feature of REST. The PUT method is only used upon update. I had written code for GET and PUT and I should have had something for POST. That being said, I'm pretty sure PUT doesn't work on many servers, and you need to flip on http://documentcloud.github.com/backbone/#Sync-emulateHTTP to make backbone work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM