Is there a way to modify Discourse endpoints through plugin?


(Chong An Chen) #1

for example, I want to change the result on /latest.json endpoint,
and I found the controller is list_controller.rb,
is there a way to modify related functions through plugin?


(Joffrey Jaffeux) #2

There’s almost nothing a plugin can’t do. The question is generally more: is it a good idea ? is it maintainable?

What have you tried so far ?

A good starting point it to look at our all-the-plugins repo and search for similar patterns.


#3

It’s best to look at an example, I believe you can amend the serialisers:

Consider this:

With, for example, the Topic List Previews Plugin edits, from here:

This appends a load of extra attributes. Try it and take a look.


(Chong An Chen) #4

ok, thank you so much!