File tree Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 55 "main" : " index.js" ,
66 "dependencies" : {
77 "body-parser" : " ^1.18.3" ,
8+ "cookie-parser" : " ^1.4.5" ,
89 "express" : " ^4.16.3"
910 },
1011 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -442,6 +442,7 @@ module Middleware = {
442442 "type": string ,
443443 "limit": Js . Nullable . t (int ),
444444 };
445+ type cookieOptions = {. "decode": option (string => Js . Json . t )};
445446 [@ bs . module "express" ] [@ bs . val ] external json_ : jsonOptions => t = "json" ;
446447 [@ bs . module "express" ] [@ bs . val ]
447448 external urlencoded_ : urlEncodedOptions => t = "urlencoded" ;
@@ -488,6 +489,10 @@ module Middleware = {
488489 "limit" : ByteLimit . toBytes(limit),
489490 "inflate" : inflate,
490491 });
492+ [@ bs . module "cookie-parser" ] [@ bs . val ]
493+ external cookie_ : (option (string ), cookieOptions ) => t = "raw" ;
494+ let cookie = (~secret=?, ~decode=?, () ) =>
495+ cookie_(secret, {"decode" : decode});
491496 module type S = {
492497 type f ;
493498 type errorF ;
Original file line number Diff line number Diff line change @@ -304,6 +304,7 @@ module Middleware: {
304304 unit
305305 ) =>
306306 t ;
307+ let cookie : (~secret : string =?, ~decode : string => Js . Json . t =?, unit ) => t ;
307308 module type S = {
308309 type f ;
309310 let from : f => t ;
You can’t perform that action at this time.
0 commit comments