react-china / forum-frontend

React implemented frontend for react-china.org
60 stars 6 forks source link

Discourse API 整理 #1

Open tiye opened 9 years ago

tiye commented 9 years ago

当前已经明确的文档: https://meta.discourse.org/t/discourse-api-documentation/22706 http://bbs.react-china.org/categories.json

另外前端调用 CORS 请求似乎需要在论坛服务器上开启, 我这两天看下

pinyin commented 9 years ago

https://github.com/discourse/discourse/blob/master/config/routes.rb

https://github.com/dhyasama/discourse-api

看上去挺复杂的

tiye commented 9 years ago

我先加了粗粒度的 CORS 请求的支持, 现在应该能支持从其他网页请求数据:

add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, PUT, POST, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With";
luqin commented 9 years ago

前端是否实现成 API 客户端?

tiye commented 9 years ago

最初的想法是这样的. 按照思路后面还应该找登录的 API, 不过还没弄明白怎么搞...

tiye commented 9 years ago

跟进一下这个帖子 https://meta.discoursecn.org/t/%E4%BD%BF%E7%94%A8-Discourse-API/38/

szhclaye commented 9 years ago

还没开始写呢?

geminiyellow commented 9 years ago

这个 apis 就是渣渣。

luqin commented 9 years ago

@geminiyellow 哈哈

geminiyellow commented 9 years ago

@luqin 如果写 sdk 包的话,再配 redux 中间件,想不到有什么好办法来区分每个不同的请求。 很不好弄,直接写 actions 的话我觉得又好散。

pinyin commented 9 years ago

不考虑一下引入RxJS吗?Redux写法局限性还是挺大的

geminiyellow commented 9 years ago

@pinyin 你推个 PR 呗。合适就合进去。反正现在都是实验田。

luqin commented 9 years ago

sdk指的是api独立模块?

luqin commented 9 years ago

api要考虑react-native复用

geminiyellow commented 9 years ago

@luqin https://github.com/dhyasama/discourse-api 这个是可以的啊。

luqin commented 9 years ago

@geminiyellow 这是node端的,可以用

geminiyellow commented 9 years ago

@luqin 我知道可以用,只是觉得很麻烦而已。并且粗看起来似乎不完整。