Giter VIP home page Giter VIP logo

router.cr's People

Contributors

luislavena avatar mamantoha avatar romanhargrave avatar s0kil avatar stakach avatar tbrand avatar veelenga avatar vladfaust avatar waghanza 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  avatar  avatar

router.cr's Issues

Commit messages

I don't want to step on your toes here but how about writing some more descriptive commit messages in the future? :) "Fix" doesn't tell me much. :P

"routers" don't cooperate when combined

You should be able to combine multiple handlers that can handle different routes (e.g. a handler for /favicon.ico or a monitoring API, etc...)

Route::RouteHandler#call(context) raises an exception when it can't route rather than "passing the torch" to the next handler. This makes combining routers impossible.

Version badge

Hi @tbrand,

I can see on README that version is pin to 0.2.2

However, the last version is 0.2.4

Regards,

Is the project maintained?

Hello,

I've checked your project and it either:

  • Has specs failed with the latest Crystal (0.26.1)
  • Has no any specs to run so it cannot be validated to be up to date
  • Has the latest commit dated more than a year ago

Your project is in Awesome Crystal list, so I'd like to ask if the project maintained?

I'll initiate a PR to remove your project from the list if you don't respond positively within 7 days.

I'm sorry if I'm wrong, because I've been checking many shards with automated script.

Thanks,
Vlad.

Add tests for TechEmpower Framework Benchmarks

Hi @tbrand, I like router.cr as middleware.

Would be possible to add router.cr to https://github.com/TechEmpower/FrameworkBenchmarks ?

TFB have three categories:

  1. Middlewares, like puma, nginx
  2. Micro frameworks like Kemal, Sinatra, Flask
  3. Full frameworks like Phoenix, Django, Amber.

I think router.cr can compete in the first category, What do you think?

Tests for crystal-raw: https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Crystal/crystal

Parsing POST/GET params?

Is there an example for how to retrieve POST params from an HTML form? router.cr seems to ignore GET and POST params, only providing the params available in the URL (e.g., '/posts/:post_id').

Am I missing something? Or is that a limitation of this router framework?

Incorrect release tag

This makes shards think it has to fetch the repo on every build. To fix this the git tag should match the version in shards.yml

Add constraint to route

Hi @tbrand,

It could be useful to add some path constraint to routes, I mean adding a regex (or else to allow / or not some pathes).

For example, adding /user/:id(\\d+), create a route for /user/0, /user/1... but not/user/a`

WDYT ?

PS : This example is taken from kitura

Feature Request: Add method or class handler

As addition to use block handler, it would be nice to add method handler or class handler to make the router code cleaner and follow separation of concern.

# block handler
get "/" do |context, params|
 context.response.print "Hello router.cr!"
 context
end

# method handler
get "/" home
post "/user" add_user

def home(context, params) : HTTP::Server::Context
  context.response.print "Hello router.cr!"
  context
end

# class handler
article = Article.new
get "/article/:id" article.get 
put "/article/:id" article.update 

class Article
  def get(context, params)
    context.response.print "Hello router.cr!"
    context
  end
end

Performance optimization with slice

Is it possible to improve performance if the router could convert string to bytes using to_slice?

From the benchmark, to_slice would cost <4 nanoseconds and efficient to compare using ==

Range  17.51M ( 57.11ns) (±10.77%)  32 B/op  14.44× slower
Slice     252.8M (  3.96ns) (± 5.81%)   0 B/op        fastest

Range:
key[0..-2]

Slice:
(key.to_slice)[0,key.size-2]

Question: Separating Route Class

What is best way to separate route in different class. I'm thinking to create modular app and each has its own route declaration.

Rename API to Action

When a server is accessed with a path, it idiomatically triggers something a.k.a. an action happens. My proposal is to replace API (alias API = Proc(HTTP::Server::Context, Hash(String, String)) with Action.

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.