This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----------------------------------server.js---------------------------------------- | |
************************************************************************************ | |
import express from "express" | |
import rootRoute from "./src/root_Route.js" | |
import cookieParser from "cookie-parser" | |
import passport from "passport" | |
import connectPgSimple from "connect-pg-simple" | |
import session from "express-session" | |
import dotenv from "dotenv" | |
import cors from "cors" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from "express" | |
import rootRoute from "./src/root_Route.js" | |
import cookieParser from "cookie-parser" | |
import passport from "passport" | |
import connectPgSimple from "connect-pg-simple" | |
import session from "express-session" | |
import dotenv from "dotenv" | |
import cors from "cors" | |
import "./src/LIB/DB-Client.js" | |
import "./src/PASSPORT_STRATEGY/google-auth-strategy.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Google auth logic | |
const { generateFromEmail } = require("unique-username-generator") | |
const passport = require("passport") | |
const GoogleStrategy = require("passport-google-oauth2").Strategy | |
const bcrypt = require("bcryptjs") | |
const crypto = require("crypto") | |
const pool = require("../LIB/DB-Client") | |
passport.use( | |
new GoogleStrategy( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- migrate:down | |
drop table if exists users; | |
drop table if exists slot; | |
drop table if exists verify_token; | |
drop table if exists winner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- migrate:up | |
create table session ( | |
sid text primary key not null, | |
sess json not null, | |
expire timestamp() not null | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
-- CreateTable | |
CREATE TABLE "session" ( | |
"sid" VARCHAR NOT NULL, | |
"sess" JSON NOT NULL, | |
"expire" TIMESTAMP() NOT NULL, | |
CONSTRAINT "session_pkey" PRIMARY KEY ("sid") | |
); |