Skip to content

Instantly share code, notes, and snippets.

Created April 22, 2013 21:25
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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 =
'/' => 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
# snip
not_found do
Jbuilder.encode do |json|
json.error 'not found'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment