Created
          October 30, 2019 22:39 
        
      - 
      
- 
        Save thehenster/872db5a248daccee7c5106f6dd6a4ec4 to your computer and use it in GitHub Desktop. 
    Rackup file for dynamic requests, then static files, then not found
  
        
  
    
      This file contains hidden or 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 'rack' | |
| require 'rack/static' | |
| class App | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| req = Rack::Request.new(env) | |
| case req.path | |
| when "/hello" | |
| [200, {}, ["Hello"]] | |
| else | |
| @app.call(env) | |
| end | |
| end | |
| end | |
| use App | |
| use Rack::Static | |
| run -> (env) { [404, {}, ["Not found"]] } | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment