Created
April 22, 2013 21:25
-
-
Save rbq/5438683 to your computer and use it in GitHub Desktop.
Problem: not_found doesn't work at all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'rack/urlmap' | |
require File.join(File.dirname(__FILE__), 'app') | |
require File.join(File.dirname(__FILE__), 'api', 'v1') | |
routes = Rack::URLMap.new( | |
'/' => Sinatra::Application, | |
'/api/v1/' => ApiV1 | |
) | |
set :environment, :production | |
run routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), '..', 'config', 'environment') | |
require 'sinatra/base' | |
class ApiV1 < Sinatra::Base | |
before do | |
content_type :json | |
end | |
# snip | |
not_found do | |
Jbuilder.encode do |json| | |
json.error 'not found' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment