Installation 📦
To include it in your package, add the following to your Package.swift
file.
let package = Package(
name: "Project",
dependencies: [
...
.package(name: "FirebaseJWTMiddleware", url: "https://github.com/barisatamer/vapor-firebase-jwt-middleware.git", .branch("vapor4")),
],
targets: [
.target(name: "App", dependencies: [
.product(name: "FirebaseJWTMiddleware", package: "FirebaseJWTMiddleware"),
...
])
]
)
Usage 🚀
- Configure Project ID
app.firebaseJwt.applicationIdentifier = <YOUR_FIREBASE_PROJECT_ID>
- Import header files
import FirebaseJWTMiddleware
- Adding Middleware to a Routing Group
let group = router.grouped(FirebaseJWTMiddleware())
group.get("welcome") { req in
return "Hello, world!"
}