Commit Graph

30 Commits

Author SHA1 Message Date
Sijawusz Pur Rahnama 210e2c0801 Prettify docs (#410) 2017-10-06 14:53:53 +03:00
Cris Ward 30bdcc9759 only return strings from routes fixes #374 (#408) 2017-10-02 23:47:43 +03:00
Serdar Dogruyol 1c069ab643 Refactor 2017-09-05 11:10:04 +03:00
Serdar Dogruyol 00217d9545 Add more types to method signatures 2017-08-24 23:32:43 +03:00
sdogruyol 0724e07c22 Make Route a Struct 2017-05-13 18:39:11 -07:00
Sijawusz Pur Rahnama e0511743b1 Add getters to Route#{path,method} (#332) 2017-03-12 18:40:30 +02:00
Serdar Dogruyol 922d6de4d1 Middleware ordering (#236)
Improve and correct request middleware

 Request -> Middleware -> Filter -> Route
2016-10-28 11:35:34 +03:00
Sdogruyol f7484d14d3 Use nested module declaration 2016-07-17 14:43:13 +03:00
sdogruyol 2b9152ff79 Update instance types 2016-04-13 11:00:02 +03:00
sdogruyol b4bc818490 Update handler 2016-04-12 17:35:29 +03:00
sdogruyol c47c9488fe Return string from context 2016-04-12 17:15:43 +03:00
sdogruyol 05e44e68c6 Updating to instance types 2016-04-12 14:41:09 +03:00
sdogruyol 5a58ee3cbb Format code 2016-02-17 11:52:13 +02:00
Joris Moriau c5201f01ad added verb for filters and minor improvements 2016-02-17 10:34:01 +01:00
Fatih Kadir Akın ce1f595c5d Remove param parsing with regex since Radix has state-machine implementation which is a way faster 2016-01-25 22:52:41 +02:00
Sdogruyol d1f95c0f39 All specs passing except macros 2016-01-24 12:22:25 +02:00
Fatih Kadir Akın 7d0d5add84 Implement radix algorithm for routing (thanks to beryl) 2016-01-22 23:06:13 +02:00
Luis Lavena df359d66c9 Build Route Regex once to reduce allocations
Right now every `match?` performed against the routes defined result
in a new Regex compiled for the exact same `@path`.

Since `@path` of the Route does not change on every request, we
pre-build it to avoid repeated allocations.

When testing this in release mode (against 0.10.2 [d1e3f0b]):

Before: 32408.48 req/s
After:  34862.07 req/s
2016-01-18 13:48:41 -03:00
Sdogruyol 788c7241d4 Handle cases when logger can be nil 2016-01-18 17:25:52 +02:00
sdogruyol b37dd29d4b Update router to handle method matching 2016-01-13 15:22:50 +02:00
Sdogruyol 0b4a36953f Started reimplementing router 2016-01-12 21:37:12 +02:00
Sdogruyol 5c97942707 Add more documentation 2015-12-13 10:25:04 +02:00
Sdogruyol a67a8508cf Add worker support (experimental) 2015-12-08 22:15:13 +02:00
Imran Latif c42f1f88e9 Added support for magic param `_method` just like Rails, Sinatra.
Following are the changes made in this commit:

- Added support for magic param `_method` just like Rails, Sinatra
etc.. Browsers which don't support `PUT`, `PATCH` and `DELETE` methods
can simulate them by sending `method` param in request body.

- The default Content-Type to parse request body submitted via forms
etc. is `application/x-www-form-urlencoded`. But if we send Ajax
request in Chrome ($.post) then by-default Content-Type is set to
`application/x-www-form-urlencoded; charset utf-8` which was not
getting matched. I changed the code from `==` to match against a
regular expression using `=~`.

- Print name and color of overridden HTTP method via Logger instead of
printing name and color or request's incoming HTTP method.

Making necessary changes as pointed by @sdogruyol

- Changed method name from`is_override_method_valid?` to
`override_method_valid?`.

- Refactored `if` condition in `override_method_valid?`.
2015-12-03 01:34:16 +05:00
Sdogruyol 0e617dcfb6 Removed redundant code for more performant processing 2015-11-15 17:00:51 +02:00
Sdogruyol c49191e650 Fixed match bug 2015-10-31 09:28:25 +02:00
Sdogruyol 5892d900ff Added documentation for context, param_parser and route 2015-10-29 17:16:29 +02:00
Sdogruyol 3cc50e0a7e Added param parser 2015-10-28 20:30:27 +02:00
Sdogruyol 5749a7db60 Formatted 2015-10-23 22:54:18 +03:00
Sdogruyol 5ca84fea4c Renamed all occurrences to Kemal 2015-10-23 21:33:26 +03:00
Renamed from src/frank/route.cr (Browse further)