cookie-parser - cookie parsing with signatures.
Parse Cookie header and populate req.cookies with an object keyed by the cookie names. Optionally you may enable signed cookie support by passing a secret string, which assigns req.secret so it may be used by other middleware.
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.JSON
import io.scalajs.npm.cookieparser._
import io.scalajs.npm.express.{Express, Request, Response}
val app = Express()
app.use(CookieParser("test123"))
val results = CookieParser.JSONCookie("foo=bar; equation=E%3Dmc%5E2")
println(s"cookies => ${JSON.stringify(results.orNull)}")
To add the CookieParser
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "cookie-parser" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")