1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-20 19:52:47 +02:00
Commit Graph

36 Commits

Author SHA1 Message Date
Rene Jochum
0769b34b52 Use the NotFoundHandler when a file haven't been found. (#966)
This is especialy usefull when you use e.Static("/", "static") and you
want a notfoundhandler that serves your index.html like this:

echo.NotFoundHandler = func(c2 echo.Context) error {
	index := filepath.Join(c.config.StaticDir, c.config.Index)
	_, err := os.Open(index)
	if err != nil {
		return echo.ErrNotFound
	}
	return c2.File(path.Join(c.config.StaticDir, c.config.Index))
}

Another usecase with the Handler above is HTML5 SPF applications.

One caveat, you need to make sure that your NotFoundHandler doesn't
produce loops.

Signed-off-by: Rene Jochum <rene@jochums.at>
2017-07-19 11:29:41 -07:00
Nick Law
e0ea129c5c Expose echo.Add() for dynamic route registration (#965) 2017-07-03 19:10:58 -07:00
Miha Valencic
c04b028852 Support route naming and generating URLs based on route names (#960)
* Route registration methods return Route object

* Renamed Route#Handler to Route#Name

* Adding route return value to Any, Match, Static and File methods.
2017-06-22 10:59:02 -07:00
Vishal Rana
6bb7747530 Updated docs
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-03-05 19:08:11 -08:00
Vishal Rana
91d2727522 Fixed #838
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 13:04:08 -08:00
Vishal Rana
891d8519d7 fixed #701
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-30 15:03:18 -07:00
Vishal Rana
796df515f3 fixed #700
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-30 13:29:37 -07:00
Vishal Rana
58166d599b fixed default routes for group
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-29 22:54:06 -07:00
Vishal Rana
8067b8eaf7 fixed group static
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-25 18:47:11 -07:00
Vishal Rana
4760f4cedf fixed recipes for static middleware change
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-22 16:38:01 -07:00
Vishal Rana
954efac63a fixed #684
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-22 15:18:55 -07:00
Vishal Rana
12573cd76d fixed #675
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-22 12:32:39 -07:00
Vishal Rana
2bdbf6918e fixed #623
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-14 14:52:40 -07:00
Vishal Rana
d5b3fef5c9 removed deprecated functions group.go
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-13 14:04:08 -07:00
Vishal Rana
8623669cbc removed Context#P()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 18:22:13 -07:00
Vishal Rana
e918eacd9d Fixed #622
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-08-11 16:25:03 -07:00
Russ Egan
2eb5d97b19 Fix issue with middleware from one route leaking into the middleware of other routes
Fixed #565

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-16 07:29:25 -07:00
Vishal Rana
1c2d6341ba Fixed #474
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-18 16:59:58 -07:00
Vishal Rana
94a16d25a3 Fixed #461
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-11 23:21:32 -07:00
Vishal Rana
130c548826 Closes #459, #457.
- Static back as middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-10 20:56:10 -07:00
Vishal Rana
2f8639b7e6 Just some variable changes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-09 16:09:50 -07:00
Vishal Rana
33700bfcc2 Fixed #457
- Dropped static middleware in favor of Echo#Static & Echo#StaticConfig.
- Enhanced middleware chaining.

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-09 14:00:23 -07:00
Vishal Rana
b5d6c05101 Fixed #441, #294
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-02 14:24:51 -07:00
Vishal Rana
c4caeb8ffb more godoc
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-19 15:47:20 -07:00
Vishal Rana
3abe661e72 Fixed nested group middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-16 20:25:58 -07:00
Vishal Rana
2d6aaa8a33 Fixed #405
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-15 08:33:57 -07:00
Vishal Rana
296498c942 Fixed nested groups, reset Context#handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-08 19:31:11 -08:00
Vishal Rana
b97a2c5ad6 Fixed group middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-20 08:11:02 -08:00
Vishal Rana
caf3bd31eb - Handler and middleware signature changed
- Pre chain middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-15 19:32:16 -08:00
Vishal Rana
51acf465fe - Moved static file serving to a new handler package
- Middleware at route level
- Group middleware is a in closure now

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-15 08:11:29 -08:00
Vishal Rana
33d8813eb5 Revert "Revert "Fixed Request.Out""
This reverts commit 72050d765b.
2015-12-21 15:20:49 -08:00
Vishal Rana
72050d765b Revert "Fixed Request.Out"
This reverts commit cced590a16.
2015-12-21 15:18:53 -08:00
Vishal Rana
cced590a16 Fixed Request.Out
Signed-off-by: Vishal Rana <vishal.rana@verizon.com>
2015-12-21 15:18:03 -08:00
Vishal Rana
ac527ab4da Better implementation for serving static files.
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-27 14:07:52 -07:00
Vishal Rana
e119cbc2ea Separated Group from Echo to limit API
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-22 21:24:35 -07:00
Vishal Rana
e0364caf36 Better handling in middleware for WebSocket
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-22 20:26:52 -07:00