heroku - 解析服务器响应 "Unexpected token"

标签 heroku parse-platform parse-server

我正在努力在 Heroku 上放置一个解析服务器。我正在使用这个应用程序:

https://github.com/ParsePlatform/parse-server-example

使用本指南上传到 heroku:

https://devcenter.heroku.com/articles/getting-started-with-nodejs

我已经更新了解析服务器代码中的数据库和服务器 URL,一切都正确上传和部署。但是,当我尝试按照本指南中的说明使用 cURL 测试服务器时:

https://github.com/ParsePlatform/parse-server

我收到以下错误:

{"error":"Unexpected token '"}

我已经复制并粘贴了针对我的 url 修改的 cURL 命令:
curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore

Heroku 日志显示请求传入(所以我知道它会到达正确的位置)但没有错误。如果这很重要,我正在从 Windows 7 部署。这是我第一次使用 heroku 和解析服务器,所以我有点盲目。有人看到问题了吗?

最佳答案

尝试将 POST 数据字段的简单引号反转为双引号,这对我有用:

#here : "{'score':1337,'playerName':'Sean Plott','cheatMode':false}"

curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d "{'score':1337,'playerName':'Sean Plott','cheatMode':false}" http://my-app-name.herokuapp.com/parse/classes/GameScore

反而
#here : '{"score":1337,"playerName":"Sean Plott","cheatMode":false}'
curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore

关于heroku - 解析服务器响应 "Unexpected token",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36873780/

相关文章:

ruby-on-rails - Heroku 页面显示错误,而 "heroku logs"不显示错误

python - 尝试在 python virtualenv 中安装 django-toolkit 时出错

javascript - 在继续使用 Parse.com 之前,如何将 10,000 个结果推送到数组中

ruby-on-rails - Rails 3,迁移在本地有效,在 Heroku 中不起作用?

ruby-on-rails - 在 Rails 6 和 Puma 上仍然需要工作启动时建立连接吗?

javascript - 许多请求一次解析

ios - Parse 如何处理指向同一个 PFObject 的多个指针

heroku - 解析服务器简单 Mailgun 适配器 'verifyUserEmails' 问题

node.js - 添加云代码解析服务器示例项目时找不到模块

heroku - 使用 Redis 解析 LiveQuery 独立服务器