feat: bun api support 🥟 (#1021)

* chore: update bun lockfile

* feat: backend api bun support, jose used in bun runtime

* fix: add missing await for signPayload call
This commit is contained in:
Danny Avila 2023-10-07 11:16:06 -04:00 committed by GitHub
parent c0e2c58c03
commit e7ca40b5ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 128 additions and 29 deletions

View file

@ -12,7 +12,7 @@ const { PORT, HOST, ALLOW_SOCIAL_LOGIN } = process.env ?? {};
const port = Number(PORT) || 3080;
const host = HOST || 'localhost';
const projectPath = path.join(__dirname, '..', '..', 'client');
const { jwtLogin, passportLogin } = require('../strategies');
const { jwtLogin, joseLogin, passportLogin } = require('../strategies');
const startServer = async () => {
await connectDb();
@ -39,7 +39,11 @@ const startServer = async () => {
// OAUTH
app.use(passport.initialize());
passport.use(await jwtLogin());
if (typeof Bun !== 'undefined') {
passport.use('jwt', await joseLogin());
} else {
passport.use(await jwtLogin());
}
passport.use(passportLogin());
if (ALLOW_SOCIAL_LOGIN?.toLowerCase() === 'true') {