├── .gitignore ├── README.md ├── client ├── pages │ ├── Signup.jsx │ ├── Login.jsx │ ├── Homepage.jsx │ ├── CreatePoll.jsx │ ├── TakePoll.jsx │ └── DisplayPoll.jsx ├── index.js ├── index.html ├── stylesheets │ └── styles.css └── App.jsx ├── .env ├── server ├── middleware │ ├── userMiddleware.js │ └── pollMiddleware.js ├── routers │ ├── userRouter.js │ └── pollRouter.js ├── db │ └── db.js └── server.js ├── .vscode └── launch.json ├── notes.txt ├── package.json └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scratch 2 | Application to create polls and share 3 | -------------------------------------------------------------------------------- /client/pages/Signup.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function Signup() { 4 | return (

Signup

) 5 | } 6 | 7 | export default Signup; 8 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | PG_URI=postgres://adkyirma:w7PmsQmuimLfkILvmUJfdJdvW2AZorP5@heffalump.db.elephantsql.com/adkyirma 2 | GOOGLE_CLIENT_ID=300065318729-o1jft1potgu00vtu5484hdgog3ko9l2h.apps.googleusercontent.com 3 | GOOGLE_CLIENT_SECRET=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 -------------------------------------------------------------------------------- /client/pages/Login.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | function Login() { 4 | return( 5 | <> 6 |

Login

7 | 8 | 9 | ) 10 | 11 | function handleLogin(event) { 12 | 13 | } 14 | } 15 | 16 | export default Login; -------------------------------------------------------------------------------- /client/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import { BrowserRouter } from 'react-router-dom'; 4 | import App from './App.jsx'; 5 | 6 | import styles from './stylesheets/styles.css'; 7 | 8 | // Create a root. 9 | const root = ReactDOM.createRoot(document.getElementById('root')); 10 | // Initial render 11 | root.render( 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | -------------------------------------------------------------------------------- /client/pages/Homepage.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { useNavigate } from 'react-router-dom' 3 | 4 | export const Homepage = () => { 5 | const navigate = useNavigate(); 6 | 7 | return
8 |

Poll-a-Bear

9 |
10 | 11 |
12 |
13 | } 14 | 15 | export default Homepage -------------------------------------------------------------------------------- /server/middleware/userMiddleware.js: -------------------------------------------------------------------------------- 1 | const middleware = {}; 2 | 3 | // Sign Up 4 | middleware.signUp = (req, res, next) => { 5 | res.locals = {data: 'I am signing up!'} 6 | next(); 7 | return; 8 | } 9 | 10 | // Log In 11 | middleware.logIn = (req, res, next) => { 12 | res.locals = {data: 'I am logging in!'} 13 | next(); 14 | return; 15 | } 16 | 17 | // Session Authentication 18 | middleware.verifyUser = (req, res, next) => { 19 | res.locals = {data: 'I am getting verified!'} 20 | next(); 21 | return; 22 | } 23 | 24 | 25 | module.exports = middleware; -------------------------------------------------------------------------------- /server/routers/userRouter.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const userFunctions = require('../middleware/userMiddleware'); 4 | 5 | router.post('/signup', userFunctions.signUp, (req, res) => { 6 | res.status(200).json(res.locals); 7 | return; 8 | }) 9 | 10 | router.get('/login', userFunctions.logIn, (req, res) => { 11 | res.status(200).json(res.locals); 12 | return; 13 | }) 14 | 15 | router.get('/verify', userFunctions.verifyUser, (req, res) => { 16 | res.status(200).json(res.locals); 17 | return; 18 | }) 19 | 20 | module.exports = router; 21 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**", 13 | "${workspaceFolder}/node_modules/**" 14 | ], 15 | "program": "${workspaceFolder}/server/server.js" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Document 11 | 12 | 13 | 14 |
15 | 17 |