简体   繁体   中英

What do you set root :to in api-only rails application?

Very basic question that I've having difficulty getting an answer for: I have a rails application that I am only using as an api server. My entire front-end is handled by an EmberJS app. I've noticed a particular pattern in my logs:

ActionController::RoutingError (No route matches [GET] "/"):

What do I set the root url to so that I stop getting this error?

If you want to avoid the error, and have nothing at the root you could make this the root route

root to: proc { [200, {}, ['']] }

Which will just return an empty string and status 200.

It may be better to return 404 however, considering there isn't a resource available at the root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM