Coder Social home page Coder Social logo

nyny's People

Contributors

alisnic avatar angn avatar etehtsea avatar fraunigai avatar idanci avatar juliannicholls avatar max-power avatar zigomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nyny's Issues

Namespace isolation

When namespacing some requests, if you visit just the namespace url

/api/v1 

for example, instead of

/api/v1/all

then the program will reach the "get '/' do" which is outside of the namespace. Is this the intended behavior?
A code sample is below.

  namespace '/api' do
    namespace '/v1' do
      get '/all' do
        content_type :json
        { a_key: "some_data", version: "2.0.3" }.to_json
      end
    end
  end

  get '/' do
    use Rack::Static, :urls => [""], :root => 'public', :index => 'index.html'
    content_type :html
    render './public/index.html'
  end

Unexpected shared middlewares

NYNY::App instances share their middlewares unexpectedly.

Example:

require 'nyny'
require 'rack'

Rack::Server.start app: Rack::Builder.app {
  use Class.new(NYNY::App) {
    use Rack::CommonLogger
    get '/' do
      'This is WebApp.'
    end
  }
  use Class.new(NYNY::App) {
    use Rack::CommonLogger # shouldn't reach here.
    get '/' do
      'This is APIApp.'
    end
  }
  run proc {}
}

The HTTP responses are correct, but the application emits every same access logs twice, like this:

$ curl localhost:8080
This is WebApp.
127.0.0.1 - - [25/Feb/2014 14:05:01] "GET / HTTP/1.1" 200 15 0.0005
127.0.0.1 - - [25/Feb/2014 14:05:01] "GET / HTTP/1.1" 200 15 0.0010

ArgumentError at /nested wrong number of arguments (2 for 1) when use namspace route for class app

require 'nyny'
class Ping < NYNY::App
  get '/' do #this will be accessbile at '/ping'
    'pong'
  end
end

class App < NYNY::App
  get '/' do
    'Hello'
  end

  # You can pass a Rack app to the namespace
 namespace '/ping', Ping

  # Or you can pass a block, which will create the app for you
 namespace '/nested' do
 

    get '/' do # this will be accessible at '/nested'
      'Hello from namespace!'
    end
  end
end

visit http://localhost:9292/nested/ is ok
visit http://localhost:9292/ping throw ArgumentError
it seems that namespace only works fine with block but not for class

How to make session persistent ?

Hi do a simple test

get '/' do
   { data: Vehicle.count, test: session[:test] }.to_json
end

get '/s' do
   session[:test] = Time.now.to_s
end

When I call '/s' then '/' my session[:test] object looks empty !? How to make it persistent ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.