Jeongmin Seo

Modify login code

1 -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 1 +# Logs
2 +logs
3 +*.log
4 +npm-debug.log*
5 +yarn-debug.log*
6 +yarn-error.log*
7 +lerna-debug.log*
8 +.pnpm-debug.log*
2 9
3 -# dependencies 10 +# Diagnostic reports (https://nodejs.org/api/report.html)
4 -/node_modules 11 +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
5 -/.pnp
6 -.pnp.js
7 12
8 -# testing 13 +# Runtime data
9 -/coverage 14 +pids
15 +*.pid
16 +*.seed
17 +*.pid.lock
10 18
11 -# production 19 +# Directory for instrumented libs generated by jscoverage/JSCover
12 -/build 20 +lib-cov
13 21
14 -# misc 22 +# Coverage directory used by tools like istanbul
15 -.DS_Store 23 +coverage
16 -.env.local 24 +*.lcov
17 -.env.development.local
18 -.env.test.local
19 -.env.production.local
20 25
21 -npm-debug.log* 26 +# nyc test coverage
22 -yarn-debug.log* 27 +.nyc_output
23 -yarn-error.log* 28 +
29 +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30 +.grunt
31 +
32 +# Bower dependency directory (https://bower.io/)
33 +bower_components
34 +
35 +# node-waf configuration
36 +.lock-wscript
37 +
38 +# Compiled binary addons (https://nodejs.org/api/addons.html)
39 +build/Release
40 +
41 +# Dependency directories
42 +**node_modules/
43 +jspm_packages/
44 +
45 +# Snowpack dependency directory (https://snowpack.dev/)
46 +web_modules/
47 +
48 +# TypeScript cache
49 +*.tsbuildinfo
50 +
51 +# Optional npm cache directory
52 +.npm
53 +
54 +# Optional eslint cache
55 +.eslintcache
56 +
57 +# Microbundle cache
58 +.rpt2_cache/
59 +.rts2_cache_cjs/
60 +.rts2_cache_es/
61 +.rts2_cache_umd/
62 +
63 +# Optional REPL history
64 +.node_repl_history
65 +
66 +# Output of 'npm pack'
67 +*.tgz
68 +
69 +# Yarn Integrity file
70 +.yarn-integrity
71 +
72 +# dotenv environment variables file
73 +.env
74 +.env.test
75 +.env.production
76 +
77 +# parcel-bundler cache (https://parceljs.org/)
78 +.cache
79 +.parcel-cache
80 +
81 +# Next.js build output
82 +.next
83 +out
84 +
85 +# Nuxt.js build / generate output
86 +.nuxt
87 +dist
88 +
89 +# Gatsby files
90 +.cache/
91 +# Comment in the public line in if your project uses Gatsby and not Next.js
92 +# https://nextjs.org/blog/next-9-1#public-directory-support
93 +# public
94 +
95 +# vuepress build output
96 +.vuepress/dist
97 +
98 +# Serverless directories
99 +.serverless/
100 +
101 +# FuseBox cache
102 +.fusebox/
103 +
104 +# DynamoDB Local files
105 +.dynamodb/
106 +
107 +# TernJS port file
108 +.tern-port
109 +
110 +# Stores VSCode versions used for testing VSCode extensions
111 +.vscode-test
112 +
113 +# yarn v2
114 +.yarn/cache
115 +.yarn/unplugged
116 +.yarn/build-state.yml
117 +.yarn/install-state.gz
118 +.pnp.*
...\ No newline at end of file ...\ No newline at end of file
......
1 -# Getting Started with Create React App
2 -
3 -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 -
5 -## Available Scripts
6 -
7 -In the project directory, you can run:
8 -
9 -### `npm start`
10 -
11 -Runs the app in the development mode.\
12 -Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 -
14 -The page will reload when you make changes.\
15 -You may also see any lint errors in the console.
16 -
17 -### `npm test`
18 -
19 -Launches the test runner in the interactive watch mode.\
20 -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 -
22 -### `npm run build`
23 -
24 -Builds the app for production to the `build` folder.\
25 -It correctly bundles React in production mode and optimizes the build for the best performance.
26 -
27 -The build is minified and the filenames include the hashes.\
28 -Your app is ready to be deployed!
29 -
30 -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 -
32 -### `npm run eject`
33 -
34 -**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 -
36 -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 -
38 -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 -
40 -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 -
42 -## Learn More
43 -
44 -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 -
46 -To learn React, check out the [React documentation](https://reactjs.org/).
47 -
48 -### Code Splitting
49 -
50 -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 -
52 -### Analyzing the Bundle Size
53 -
54 -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 -
56 -### Making a Progressive Web App
57 -
58 -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 -
60 -### Advanced Configuration
61 -
62 -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 -
64 -### Deployment
65 -
66 -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 -
68 -### `npm run build` fails to minify
69 -
70 -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
1 +"use strict";
2 +//모듈
3 +const express = require("express");
4 +const app = express();
5 +//라우팅
6 +const home = require("./src/routes/home");
7 +// 앱 세팅
8 +app.set("views", "./src/views");
9 +app.set("view engine", "ejs");
10 +app.use(express.static(`${__dirname}/src/public`));
11 +
12 +app.use("/", home); //미들웨어 등록해주는 method
13 +
14 +module.exports = app;
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +
3 +const PORT = 3000;
4 +
5 +const app = require("../app");
6 +
7 +app.listen(PORT, () => {
8 + console.log("서버 가동");
9 +});
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "login",
3 + "version": "1.0.0",
4 + "main": "app.js",
5 + "bin": {
6 + "login": "www.js"
7 + },
8 + "dependencies": {
9 + "ejs": "^3.1.8",
10 + "express": "^4.18.1"
11 + },
12 + "devDependencies": {},
13 + "scripts": {
14 + "start": "node ./bin/www.js",
15 + "test": "echo \"Error: no test specified\" && exit 1"
16 + },
17 + "author": "",
18 + "license": "ISC",
19 + "keywords": [],
20 + "description": ""
21 +}
1 +'use strict';
2 +
3 +console.log("hello");
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +
3 +const hello = (req, res) => {
4 + res.render("home/index");
5 +};
6 +
7 +const login = (req, res) => {
8 + res.render("home/login");
9 +};
10 +
11 +module.exports = {
12 + hello,
13 + login,
14 +};
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +
3 +const express = require("express");
4 +const router = express.Router();
5 +
6 +const ctrl = require("./home.ctrl");
7 +
8 +router.get("/", ctrl.hello);
9 +router.get("/login", ctrl.login);
10 +
11 +module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6 + <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 + <title>Document</title>
8 + </head>
9 + <body>
10 + 여기는 루트입니다.
11 + </body>
12 +</html>
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6 + <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 + <script src="/js/home/login.js"></script>
8 + <title>Document</title>
9 + </head>
10 + <body>
11 + <input type="text" placeholder="아이디" /><br />
12 + <input type="text" placeholder="비밀번호" /><br />
13 + <button>로그인</button>
14 + </body>
15 +</html>
This diff could not be displayed because it is too large.
1 -{
2 - "name": "login",
3 - "version": "0.1.0",
4 - "private": true,
5 - "dependencies": {
6 - "@testing-library/jest-dom": "^5.16.4",
7 - "@testing-library/react": "^13.2.0",
8 - "@testing-library/user-event": "^13.5.0",
9 - "react": "^18.1.0",
10 - "react-dom": "^18.1.0",
11 - "react-scripts": "5.0.1",
12 - "web-vitals": "^2.1.4"
13 - },
14 - "scripts": {
15 - "start": "react-scripts start",
16 - "build": "react-scripts build",
17 - "test": "react-scripts test",
18 - "eject": "react-scripts eject"
19 - },
20 - "eslintConfig": {
21 - "extends": [
22 - "react-app",
23 - "react-app/jest"
24 - ]
25 - },
26 - "browserslist": {
27 - "production": [
28 - ">0.2%",
29 - "not dead",
30 - "not op_mini all"
31 - ],
32 - "development": [
33 - "last 1 chrome version",
34 - "last 1 firefox version",
35 - "last 1 safari version"
36 - ]
37 - }
38 -}
No preview for this file type
1 -<!DOCTYPE html>
2 -<html lang="en">
3 - <head>
4 - <meta charset="utf-8" />
5 - <base href="/" />
6 - <link rel="icon" href="%PUBLIC_URL%/favicon.jpg" />
7 - <meta name="viewport" content="width=device-width, initial-scale=1" />
8 - <meta name="theme-color" content="#000000" />
9 - <meta
10 - name="description"
11 - content="Web site created using create-react-app"
12 - />
13 - <link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.jpg" />
14 - <!--
15 - manifest.json provides metadata used when your web app is installed on a
16 - user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
17 - -->
18 - <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
19 - <!--
20 - Notice the use of %PUBLIC_URL% in the tags above.
21 - It will be replaced with the URL of the `public` folder during the build.
22 - Only files inside the `public` folder can be referenced from the HTML.
23 -
24 - Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
25 - work correctly both with client-side routing and a non-root public URL.
26 - Learn how to configure a non-root public URL by running `npm run build`.
27 - -->
28 - <link
29 - rel="stylesheet"
30 - href="https://fonts.googleapis.com/icon?family=Material+Icons"
31 - />
32 - <title>Favorite Restaurant</title>
33 - </head>
34 - <div class="body">
35 - <noscript>You need to enable JavaScript to run this app.</noscript>
36 - <div id="root"></div>
37 - <!--
38 - This HTML file is a template.
39 - If you open it directly in the browser, you will see an empty page.
40 -
41 - You can add webfonts, meta tags, or analytics to this file.
42 - The build step will place the bundled scripts into the <body> tag.
43 -
44 - To begin the development, run `npm start` or `yarn start`.
45 - To create a production bundle, use `npm run build` or `yarn build`.
46 - -->
47 - <script
48 - src="https://kit.fontawesome.com/211c293e35.js"
49 - crossorigin="anonymous"
50 - ></script>
51 - </div>
52 -</html>
1 -{
2 - "short_name": "React App",
3 - "name": "Create React App Sample",
4 - "icons": [
5 - {
6 - "src": "favicon.ico",
7 - "sizes": "64x64 32x32 24x24 16x16",
8 - "type": "image/x-icon"
9 - },
10 - {
11 - "src": "logo192.png",
12 - "type": "image/png",
13 - "sizes": "192x192"
14 - },
15 - {
16 - "src": "logo512.png",
17 - "type": "image/png",
18 - "sizes": "512x512"
19 - }
20 - ],
21 - "start_url": ".",
22 - "display": "standalone",
23 - "theme_color": "#000000",
24 - "background_color": "#ffffff"
25 -}
1 -# https://www.robotstxt.org/robotstxt.html
2 -User-agent: *
3 -Disallow:
1 -* {
2 - margin: 0;
3 -}
4 -
5 -.app {
6 - background-color: #dae0e6;
7 - margin: auto 1px;
8 - width: 100%;
9 - height: 100%;
10 -}
11 -
12 -.app__body {
13 - padding-top: 70px;
14 - display: flex;
15 - justify-content: center;
16 - align-items: center;
17 - flex-direction: column;
18 -}
1 -import "./App.css";
2 -import {useEffect } from "react";
3 -import firebase from "./components/firebase/firebase";
4 -import { Switch, Route, useHistory } from "react-router-dom";
5 -import SignupPage from "./components/signuppage/SignupPage";
6 -import LoginPage from "./components/loginpage/LoginPage";
7 -import MainPage from "./components/mainpage/MainPage";
8 -import { useDispatch, useSelector } from "react-redux";
9 -import { setUser, clearUser } from "./redux/actions/user_action";
10 -
11 -
12 -function App(props) {
13 - let history = useHistory();
14 - let dispatch = useDispatch();
15 -
16 - const isLoading = useSelector((state) => state.user.isLoading);
17 - useEffect(() => {
18 -
19 -
20 - firebase.auth().onAuthStateChanged(function (user) {
21 - // user 있으면 로그인 된 / user 없으면 안 된 상태
22 - if (user) {
23 - history.push("/");
24 - dispatch(setUser(user));
25 - } else {
26 - history.push("/login");
27 - dispatch(clearUser());
28 - }
29 - });
30 - }, [dispatch, history]);
31 -
32 - if (isLoading) {
33 - return (
34 - <div
35 - style={{
36 - display: "flex",
37 - alignItems: "center",
38 - justifyContent: "center",
39 - height: "100vh ",
40 - }}
41 - >
42 - <span>LOADING...</span>
43 - </div>
44 - );
45 - } else {
46 - return (
47 - <Switch>
48 - <Route exact path="/" component={MainPage}></Route>
49 - <Route exact path="/login" component={LoginPage}></Route>
50 - <Route exact path="/signup" component={SignupPage}></Route>
51 - </Switch>
52 - );
53 - }
54 -}
55 -
56 -export default App;
1 -.body {
2 - margin: 0;
3 - font-family: "Segoe UI", "Roboto", "Oxygen",
4 - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 - sans-serif;
6 - -webkit-font-smoothing: antialiased;
7 - -moz-osx-font-smoothing: grayscale;
8 - background-color: #fafafa;
9 -}
10 -html {
11 - overflow-x: hidden;
12 -}
13 -
14 -.loginbody,
15 -.signupbody {
16 - margin: 0;
17 - background-image: url("./background.jpg");
18 - background-repeat: no-repeat;
19 - background-size: cover;
20 - width: 100%;
21 - height: 100vh;
22 -}
23 -
24 -code {
25 - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
26 - monospace;
27 -}
28 -
29 -.auth-wrapper {
30 - display: flex;
31 - flex-direction: column;
32 - justify-content: center;
33 - align-items: center;
34 - padding: 60px;
35 - padding-left: 180px;
36 - padding-bottom: 0px;
37 - margin: 0px auto;
38 - width: 100vw;
39 - max-width: 400px;
40 - height: 90vh;
41 - border-color: black;
42 - border-radius: 5px;
43 - float: left;
44 -}
45 -
46 -
47 -
48 -.auth-wrapper form {
49 - width: 375px;
50 - margin: 0 auto;
51 - justify-content: center;
52 - align-items: center;
53 -}
54 -
55 -.auth-wrapper h1 {
56 - font-weight: 1000;
57 - text-align: center;
58 - padding-bottom: 20px;
59 - letter-spacing: 10px;
60 - color: #fafafa;
61 -}
62 -
63 -.auth-wrapper span {
64 - color: white;
65 -}
66 -
67 -.auth-wrapper span::before {
68 - display: inline;
69 - padding-top: 10px;
70 - content: "";
71 -}
72 -
73 -.auth-wrapper input {
74 - display: block;
75 - box-sizing: border-box;
76 - width: 100%;
77 - border-radius: 4px;
78 - border: 1px solid black;
79 - padding: 10px 15px;
80 - margin-bottom: 10px;
81 - font-size: 14px;
82 -}
83 -
84 -.auth-wrapper label {
85 - line-height: 2;
86 - text-align: left;
87 - display: block;
88 - margin: 5px 0;
89 - font-size: 14px;
90 - font-weight: 200;
91 - color: #fafafa;
92 -}
93 -
94 -.auth-wrapper button[type="submit"],
95 -.auth-wrapper input[type="submit"] {
96 - background: #5b63ac;
97 - color: white;
98 - text-transform: uppercase;
99 - border: none;
100 - border-radius: 20px;
101 - margin-top: 30px;
102 - margin-bottom: 15px;
103 - padding: 15px;
104 - font-size: 20px;
105 - font-weight: 400;
106 - letter-spacing: 3px;
107 -}
108 -
109 -.auth-wrapper button[type="submit"]:hover,
110 -.auth-wrapper input[type="submit"]:hover {
111 - background: #8893e4;
112 -}
113 -
114 -.auth-wrapper button[type="submit"]:active,
115 -.auth-wrapper input[type="button"]:active,
116 -.auth-wrapper input[type="submit"]:active {
117 - transition: 0.3s all;
118 - transform: translateY(3px);
119 - border: 1px solid transparent;
120 - opacity: 0.8;
121 -}
122 -
123 -.auth-wrapper input:disabled {
124 - opacity: 0.4;
125 -}
126 -
127 -.auth-wrapper input[type="button"]:hover {
128 - transition: 0.3s all;
129 -}
130 -
131 -.auth-wrapper button[type="submit"],
132 -.auth-wrapper input[type="button"],
133 -.auth-wrapper input[type="submit"] {
134 - -webkit-appearance: none;
135 -}
136 -
137 -.auth-wrapper button[type="button"] {
138 - display: block;
139 - appearance: none;
140 - background: #5b63ac;
141 - color: white;
142 - border: none;
143 - text-transform: uppercase;
144 - padding: 10px 20px;
145 - border-radius: 4px;
146 -}
147 -
148 -.auth-wrapper .name {
149 - display: flex;
150 - flex-direction: column;
151 - margin-bottom: 30px;
152 -}
153 -
154 -.auth-wrapper .nicknameinput {
155 - display: flex;
156 -}
157 -
158 -.auth-wrapper #nicknameCheck {
159 - position: relative;
160 -}
161 -
162 -.auth-wrapper #nicknameCheck__error {
163 - display: inline;
164 - margin-bottom: 10px;
165 - margin-top: 10px;
166 - font-size: 15px;
167 -}
168 -
169 -.auth-wrapper hr {
170 - margin-top: 30px;
171 -}
172 -
173 -.auth-wrapper button {
174 - display: block;
175 - appearance: none;
176 - margin-top: 40px;
177 - border: 1px solid #333;
178 - margin-bottom: 20px;
179 - text-transform: uppercase;
180 - padding: 10px 20px;
181 - border-radius: 4px;
182 -}
1 -import React from "react";
2 -import ReactDOM from "react-dom";
3 -import "./index.css";
4 -import App from "./App";
5 -import { Provider } from "react-redux";
6 -import { applyMiddleware, createStore } from "redux";
7 -import promiseMiddleware from "redux-promise";
8 -import ReduxThunk from "redux-thunk";
9 -import Reducer from "./redux/reducers";
10 -import { BrowserRouter as Router } from "react-router-dom";
11 -
12 -const createStoreWithMiddleware = applyMiddleware(
13 - promiseMiddleware,
14 - ReduxThunk
15 -)(createStore);
16 -
17 -ReactDOM.render(
18 - <React.StrictMode>
19 - <Provider
20 - store={createStoreWithMiddleware(
21 - Reducer,
22 - window.__REDUX_DEVTOOLS_EXTENSION__ &&
23 - window.__REDUX_DEVTOOLS_EXTENSION__()
24 - )}
25 - >
26 - <Router>
27 - <App />
28 - </Router>
29 - </Provider>
30 - </React.StrictMode>,
31 - document.getElementById("root")
32 -);
1 -/// <reference types="react-scripts" />
1 -const reportWebVitals = (onPerfEntry) => {
2 - if (onPerfEntry && onPerfEntry instanceof Function) {
3 - import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 - getCLS(onPerfEntry);
5 - getFID(onPerfEntry);
6 - getFCP(onPerfEntry);
7 - getLCP(onPerfEntry);
8 - getTTFB(onPerfEntry);
9 - });
10 - }
11 -};
12 -
13 -export default reportWebVitals;