My custom route generates 404

Hello,
I’m trying to get new site section working…

I’ve got .json part succesfully serving data (http://localhost/faq_categories.json)

But for HTML request (http://localhost/faq_categories) Discourse generates 404 not found “Oops! That page doesn’t exist or is private”. I do have proper erb.html file in place.

I think that routing is working correctly (otherwise there would be error). Is there any part of Discourse application that would prevent me to run this simple code correctly?

Can you please help me to find what am I missing? Thanks a lot…!

/discourse/config/routes.rb

get “/faq_categories” => “faq_categories#index”

/discourse/app/controllers/faq_categories_controller.rb

class FaqCategoriesController < ApplicationController
def index
@faq_categories = FaqCategory.all

respond_to do |format|
  format.html do
    render :index
  end
  format.json do
    render_serialized(@faq_categories, FaqCategorySerializer)
  end
end

end
end

discourse/app/views/faq_categories/index.html.erb

`

Frequently Asked Questions

`

You need to wire the front-end part. Ember router needs to know about this route too.

3 Likes

Thanks for reply! I though that when no error from ember.js is raised then its ok… Which files are essentially needed to start with (so I can debug step by step)?

ahh… I’ve just found /discourse/app/assets/javascripts/discourse/routes/app-route-map.js.es6

Now it generates only header… I will look at it…

1 Like