Skip to content

Instantly share code, notes, and snippets.

View Theodore-Kelechukwu-Onyejiaku's full-sized avatar
:octocat:
pro

Theodore Kelechukwu Onyejiaku Theodore-Kelechukwu-Onyejiaku

:octocat:
pro
View GitHub Profile
@Theodore-Kelechukwu-Onyejiaku
Theodore-Kelechukwu-Onyejiaku / app.js
Last active August 20, 2022 23:27
Server file for Open Group Chat Application
const app = require('express')();
const server = require('http').createServer(app);
const cors = require('cors');
// configure socket.io to allow cross-origin requests
const io = require('socket.io')(server, { cors: { origin: '*' } });
// set up our PORT
const MY_PREFERRED_PORT = 8000;
const PORT = process.env.PORT || MY_PREFERRED_PORT;
import NextAuth from 'next-auth';
import GithubProvider from 'next-auth/providers/github';
import Credentials from 'next-auth/providers/credentials';
import bcrypt from 'bcrypt';
import { getXataClient } from '../../../utils/xata';
const xata = getXataClient();
export const authOptions = {
session: {
import { signIn, getCsrfToken, getProviders } from 'next-auth/react';
import { RiGithubLine } from 'react-icons/ri';
import Link from 'next/link';
import { useState } from 'react';
import { useRouter } from 'next/router';
import { toast } from 'react-toastify';
import Loading from '../../components/Loading';
export default function SignIn({ csrfToken, providers }) {
const router = useRouter();
import { signIn, getProviders } from 'next-auth/react';
import { RiGithubLine } from 'react-icons/ri';
import Link from 'next/link';
import { useState } from 'react';
import { useRouter } from 'next/router';
import { toast } from 'react-toastify';
import Loading from '../../components/Loading';
export default function SignIn({ providers }) {
const router = useRouter();
import nc from 'next-connect';
import { getToken } from 'next-auth/jwt';
import multer from 'multer';
import path from 'path';
import DatauriParser from 'datauri/parser';
import cloudinary from '../../utils/cloudinary';
import { getXataClient } from '../../utils/xata';
const xata = getXataClient();
import nc from 'next-connect';
import { getToken } from 'next-auth/jwt';
import multer from 'multer';
import path from 'path';
import DatauriParser from 'datauri/parser';
import cloudinary from '../../utils/cloudinary';
import { getXataClient } from '../../utils/xata';
const handler = nc({
onError: (err, res) => {
import nc from 'next-connect';
import { getToken } from 'next-auth/jwt';
import multer from 'multer';
import path from 'path';
import DatauriParser from 'datauri/parser';
import cloudinary from '../../utils/cloudinary';
import { getXataClient } from '../../utils/xata';
const handler = nc({
onError: (err, res) => {
import React, { useState, useEffect } from 'react';
import { useSession } from 'next-auth/react';
import { useRouter } from 'next/router';
import { toast } from 'react-toastify';
import { getXataClient } from '../utils/xata';
import SkeletonLoader from '../components/SkeletonLoader';
import 'react-quill/dist/quill.snow.css';
import 'react-quill/dist/quill.bubble.css';
import { modules, formats } from '../utils/editor';
import ErrorComponent from '../components/ErrorComponent';
// Generated by Xata Codegen 0.18.0. Please do not edit.
import { buildClient } from '@xata.io/client';
/** @typedef { import('./types').SchemaTables } SchemaTables */
/** @type { SchemaTables } */
const tables = [
{
name: 'Users',
columns: [
{ name: 'username', type: 'string', unique: true },
{ name: 'email', type: 'email', unique: true },
import cloudinary from "cloudinary";
cloudinary.v2.config({
cloud_name: process.env.CLOUDINARY_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
})
export default cloudinary