The route definition
post "/sandhi/analyze", to: "sandhi_analyses#analyze"
automatically includes an optional :format
segment, so both
/sandhi/analyze # no explicit format
/sandhi/analyze.json # JSON extension
match the same sandhi_analyses#analyze
action.
Your controller already renders JSON (either with render json:
or in the respond_to do |format| … format.json … end
block), so a POST
to #{API_ROOT}/sandhi/analyze.json
is fully supported without any additional routing changes.