1
Fork 0

typescript(translucid): fixed middleware typo

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-01-19 23:34:32 +02:00 committed by prescientmoon
parent e3b8c17c56
commit 57b52f72d3
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

@ -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`);
} }
}); });
``` ```