@kenote/express-passport
v1.0.32
Published
Passport plug-in based on Express for Kenote.js.
Downloads
7
Readme
@kenote/express-passport
Passport plug-in based on Express for Kenote.js.
Usage
index.ts
import { Module, ServerFactory } from '@kenote/core'
import { ServiceEngine } from '@kenote/express'
import session from '@kenote/express-session'
import { MemoryStore } from 'express-session'
import passportPlugin from '@kenote/express-passport'
import passport from 'passport'
import { Strategy } from 'passport-local'
// Add Strategy
passport.use(new Strategy(
(username, password, done) => {
return done(null, { username })
}
))
@Module({
imports: [],
plugins: [
session({
secret: 'secret name',
store: new MemoryStore(),
resave: true,
saveUninitialized: true
}),
passportPlugin()
],
})
class AppModule {}
async bootstarp () {
let factory = await ServerFactory(new ServiceEngine()).create(AppModule)
factory.server.listen(4000)
}
MIT License.