You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// create a new Router instance which works in similar way as app.Get/Post etc
45
+
varLibRouter = express.Router()
46
+
LibRouter.Get("/lib/:api_version", func(req *request.Request, res *response.Response, next func()){
47
+
res.Json(req.Params["api_version"])
48
+
})
49
+
return *LibRoutes
50
+
}() // immediate invocation
51
+
funcmain(){
52
+
varapp = express.Express()
53
+
app.Use(LibRoutes) // attaches the Library Routes
54
+
app.Start("8080")
55
+
}
56
+
```
34
57
## Middleware
35
58
You can write custom middlewares, wrappers in the similar fashion. Middlewares can be used to add websocket upgradation lib, session handling lib, static assets server handler
36
59
```go
@@ -86,6 +109,15 @@ func main (){
86
109
app.Start("8080")
87
110
}
88
111
```
112
+
__Note__: You can now also send an auto downloadable file too using ```res.Download``` api
0 commit comments