Skip to content

Instantly share code, notes, and snippets.

@rbq
Created Apr 22, 2013
Embed
What would you like to do?
Problem: not_found doesn't work at all
# 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
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