typescript(translucid): fixed middleware typo
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
e3b8c17c56
commit
57b52f72d3
|
@ -30,17 +30,17 @@ connect.then(() => {
|
||||||
```
|
```
|
||||||
The translucid object can be used to make file bindings:
|
The translucid object can be used to make file bindings:
|
||||||
```
|
```
|
||||||
translucid.bind("/","client/index.html",true//use midleware,["myId"]);
|
translucid.bind("/","client/index.html",true,["myId"]);
|
||||||
```
|
```
|
||||||
Then you can add midleware like this:
|
Then you can add middleware like this:
|
||||||
```
|
```
|
||||||
translucid.use({
|
translucid.use({
|
||||||
name:"my midleware",
|
name:"my middleware",
|
||||||
keys:["myid"],
|
keys:["myid"],
|
||||||
run:(prev,req,res,next) => {
|
run:(prev,req,res,next) => {
|
||||||
//prev is the data that is going to be sent to the client
|
//prev is the data that is going to be sent to the client
|
||||||
//(it might for example be the index.html file);
|
//(it might for example be the index.html file);
|
||||||
next(prev+"string added by a midleware");
|
next(`${prev} <br/> string added by a middleware`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue