cc2cd72df8
A little optimisation of newPath() func.
2023-09-05 05:58:29 +04:00
92692454da
Inversed logic of if else statement to reduce nesting by 1.
2023-08-12 19:37:51 +04:00
a2cb6182e8
Updated comments.
2023-08-12 19:19:45 +04:00
aba211f3ec
Renamed a root var to a more logically suitable name base.
2023-08-12 19:19:04 +04:00
d53622908b
Shortened a Router.Handler() method by removing if statement in the end, here just returning a result of add() func is sufficient.
2023-08-12 18:56:50 +04:00
7c8baeecf5
Changed error messages in newPath().
2023-08-12 18:55:00 +04:00
d9e5024d4d
Add an outer label to this continue statement as well. Just for good looking. :)
2023-08-11 18:45:17 +04:00
3cb32c5ec9
Sub-path implemented, now you can make a sub for a section using Router's Sub(root) method and then write only what this section contains. Like s := Sub("/api/v1") and then s.Handler("/").
2023-08-11 18:42:28 +04:00
0717a2e3d3
In case a path continues, but no child was found then break out of main for loop.
...
It was a bug that when there are children in the next node, but no parameterised one, having a non-existent path element caused the main loop to continue and firing an if pathLen == i+1 case like if there was a legit node found.
2023-08-11 18:36:13 +04:00
33de30fe23
Sanitise double slashes, and return nil in get() if a path continues but a node doesn't have children.
2023-07-23 23:19:58 +04:00
2bfaae11f2
Fixed a typo in get().
2023-05-28 03:18:15 +04:00
257bd7ea76
Check if param names differ.
2023-05-28 03:17:53 +04:00
653bae85f5
Changed comment for Param().
2023-05-28 03:16:41 +04:00
4f54ab4156
Found and fixed a typo. n -> curNode.
2023-05-28 02:43:09 +04:00
9cda541108
Made ServeStatic() to return an error.
2023-05-28 01:49:21 +04:00
89c2333a4f
get and add methods get rewritten in an iterative manner instead of recursive.
2023-05-28 01:46:57 +04:00
538f1bd676
Removed / check that is performed in newPath. Return Not Acceptable if a path not starting with /.
2023-05-28 01:29:01 +04:00
a0b80ced85
Let Handler() return an error instead of panicking. Also removed checks for / and * since they are checked in newPath().
2023-05-28 01:24:18 +04:00
99a7cebd0a
Perform checks for / and * inside a newPath func.
2023-05-28 01:22:28 +04:00
5d7d595df3
Init repo!
2023-05-26 04:06:35 +04:00