-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from kw-ic-web/master
Master
- Loading branch information
Showing
51 changed files
with
6,203 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 kw-ic-web | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
다영 git | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var createError = require("http-errors"); | ||
var express = require("express"); | ||
var path = require("path"); | ||
var cookieParser = require("cookie-parser"); | ||
var logger = require("morgan"); | ||
|
||
var indexRouter = require("./routes/index"); | ||
var usersRouter = require("./routes/users"); | ||
var customersRouter = require("./routes/api/customers"); | ||
|
||
var app = express(); | ||
|
||
// view engine setup | ||
app.set("views", path.join(__dirname, "views")); | ||
app.set("view engine", "jade"); | ||
|
||
app.use(logger("dev")); | ||
app.use(express.json()); | ||
app.use(express.urlencoded({ extended: false })); | ||
app.use(cookieParser()); | ||
app.use(express.static(path.join(__dirname, "public"))); | ||
|
||
app.use("/", indexRouter); | ||
app.use("/users", usersRouter); | ||
app.use("/api/customers", customersRouter); | ||
|
||
|
||
// catch 404 and forward to error handler | ||
app.use(function (req, res, next) { | ||
next(createError(404)); | ||
}); | ||
|
||
// error handler | ||
app.use(function (err, req, res, next) { | ||
// set locals, only providing error in development | ||
res.locals.message = err.message; | ||
res.locals.error = req.app.get("env") === "development" ? err : {}; | ||
|
||
// render the error page | ||
res.status(err.status || 500); | ||
res.send("something wrong!"); | ||
}); | ||
|
||
module.exports = app; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var app = require('../app'); | ||
var debug = require('debug')('express-skeleton-html:server'); | ||
var http = require('http'); | ||
|
||
/** | ||
* Get port from environment and store in Express. | ||
*/ | ||
|
||
var port = normalizePort(process.env.PORT || '3031'); | ||
app.set('port', port); | ||
|
||
/** | ||
* Create HTTP server. | ||
*/ | ||
|
||
var server = http.createServer(app); | ||
|
||
/** | ||
* Listen on provided port, on all network interfaces. | ||
*/ | ||
|
||
server.listen(port); | ||
server.on('error', onError); | ||
server.on('listening', onListening); | ||
|
||
/** | ||
* Normalize a port into a number, string, or false. | ||
*/ | ||
|
||
function normalizePort(val) { | ||
var port = parseInt(val, 10); | ||
|
||
if (isNaN(port)) { | ||
// named pipe | ||
return val; | ||
} | ||
|
||
if (port >= 0) { | ||
// port number | ||
return port; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "error" event. | ||
*/ | ||
|
||
function onError(error) { | ||
if (error.syscall !== 'listen') { | ||
throw error; | ||
} | ||
|
||
var bind = typeof port === 'string' | ||
? 'Pipe ' + port | ||
: 'Port ' + port; | ||
|
||
// handle specific listen errors with friendly messages | ||
switch (error.code) { | ||
case 'EACCES': | ||
console.error(bind + ' requires elevated privileges'); | ||
process.exit(1); | ||
break; | ||
case 'EADDRINUSE': | ||
console.error(bind + ' is already in use'); | ||
process.exit(1); | ||
break; | ||
default: | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* Event listener for HTTP server "listening" event. | ||
*/ | ||
|
||
function onListening() { | ||
var addr = server.address(); | ||
var bind = typeof addr === 'string' | ||
? 'pipe ' + addr | ||
: 'port ' + addr.port; | ||
debug('Listening on ' + bind); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const header = document.getElementById("header"); | ||
const buttonContainer = document.querySelector(".button-container"); | ||
|
||
// Simulating data (replace this with actual data) | ||
const user = { name: "hello" }; | ||
const isLogin = true; | ||
|
||
// Function to navigate to a specific URL | ||
const navigateTo = (url) => { | ||
window.location.href = url; | ||
}; | ||
|
||
// Function to handle logout | ||
const logout = () => { | ||
alert("You have been logged out."); | ||
navigateTo('/'); | ||
}; | ||
|
||
// Dynamically add buttons based on login status | ||
if (isLogin && user) { | ||
const nicknameContainer = document.createElement("div"); | ||
nicknameContainer.className = "nickname"; | ||
|
||
const usernameContainer = document.createElement("div"); | ||
usernameContainer.className = "username"; | ||
usernameContainer.textContent = user.name; | ||
|
||
const createPostButton = createButton("새글작성", () => navigateTo('/write')); | ||
const logoutButton = createButton("Log out", logout); | ||
|
||
buttonContainer.appendChild(nicknameContainer); | ||
nicknameContainer.appendChild(usernameContainer); | ||
buttonContainer.appendChild(createPostButton); | ||
buttonContainer.appendChild(logoutButton); | ||
} else { | ||
const loginButton = createButton("Log in", () => navigateTo('/login')); | ||
const joinButton = createButton("Join the membership", () => navigateTo('/signup')); | ||
|
||
buttonContainer.appendChild(loginButton); | ||
buttonContainer.appendChild(joinButton); | ||
} | ||
}); | ||
|
||
// Function to create a button with a specific text and click handler | ||
function createButton(text, clickHandler) { | ||
const button = document.createElement("button"); | ||
button.className = "button"; | ||
button.textContent = text; | ||
button.addEventListener("click", clickHandler); | ||
return button; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const loginForm = document.getElementById("login-form"); | ||
const loginButton = document.getElementById("login-form-submit"); | ||
const loginErrorMsg = document.getElementById("login-error-msg"); | ||
|
||
loginButton.addEventListener("click", (event) => { | ||
event.preventDefault(); | ||
const username = loginForm.username.value; | ||
const password = loginForm.password.value; | ||
|
||
if (username === "user" && password === "web_dev") { | ||
alert("You have successfully logged in."); | ||
location.reload(); | ||
} else { | ||
loginErrorMsg.style.opacity = 1; | ||
} | ||
}); | ||
|
||
/* | ||
const { Session } = require("session/lib/session"); | ||
console.log("js/login.js"); | ||
async function submit() { | ||
var userid = document.getElementById('userid').value; | ||
var userpwd = document.getElementById('userpwd').value; | ||
// 비번 encoding | ||
var encodedPwd = window.btoa(userpwd); | ||
var Msg = document.querySelector('#Msg'); | ||
var sql = { | ||
params :{ | ||
userid : userid, | ||
userpwd : encodedPwd,} | ||
}; | ||
try { | ||
const result = await axios.get('/serverclient/logincheck', sql) | ||
console.log(result.data); | ||
console.log("토큰값::", result.data.token); | ||
sessionStorage.setItem("jwtToken", result.data.token); | ||
console.log(result.data.data) | ||
// 로그인 그리스 | ||
if (result.data.data === 1) { | ||
console.log(`userid is ${userid}`); | ||
location.href = `/home?${userid}`; | ||
} else { | ||
Msg.innerHTML = result.data; | ||
} | ||
} catch (error) { | ||
console.error("Login error:", error); | ||
Msg.innerHTML = "Login failed. Please try again."; | ||
} | ||
}*/ | ||
|
Oops, something went wrong.