in Nodebb- Create API url of all chat

how to create API url of all chat, where we can use this url to get data like topics/posts -category autor date etc etc.

1 points · 2 comments · view on lemmy.world

2 Comments

codexa@community.nodebb.org · 1 pts · 284d

you can’t directly get all chat data from nodebb with a single api unless you build a plugin or custom route. but nodebb already gives you json endpoints for most data.

for example:

https://yourforum.com/api/recent show recent posts

https://yourforum.com/api/category/%7Bcid%7D show topics in that category

https://yourforum.com/api/topic/%7Btid%7D show full topic with posts

https://yourforum.com/api/user/%7Busername%7D show user info

if you want “all chat” like messages, you’ll need to enable the nodebb-plugin-chat-api or write a small express plugin that uses SocketHelpers.getUserChats() to expose data as /api/chats.

so short answer: use built-in /api/... endpoints for posts/topics, and for private chat you gotta use plugin or custom route.

vijay-kumavat@community.nodebb.org · 1 pts · 283d

Thanks Codexa , But getting error CORS,
also this plugin (nodebb-plugin-chat-api) is not available in extend->plugins lists.

how to fix CORS without allow origin from server ? could you please provide any plugin?