임준표

HealthAssistant

1 +node_modules/
2 +*.vscode
3 +*.idea
...\ No newline at end of file ...\ No newline at end of file
1 +# [Health Assistant](http://2018102224.osschatbot.cf:23023)
2 +
3 +Health Assistant is a Web based program for Daily exercisers.
4 +
5 +* **시간 효율성:** 이 프로그램은 운동하는 사람에게 몇 세트가 남았는지 알려준다. 또한, 세트와 세트 사이에 유저가 설정한 쉬는 시간이 끝나면, 유저에게 쉬는 시간이 끝났음을 알리고, 다시 운동할 수 있게끔 해준다. 이를 통해 유저는 시간 효율적으로 운동할 수 있다.
6 +* **운동 추천 기능:** 유저들의 키, 몸무게 정보를 저장하여 비슷한 체형의 유저의 운동 루틴을 추천해주거나 운동을 많이 해보지 못한 유저가 운동법을 추천받기를 원하면, 유튜브와 연동하여 운동법을 추천해 준다.
7 +
8 +## Built with
9 +- kakao api
10 +- mysql DB
11 +- 부트스트랩
12 +- node js
13 +
14 +## Prerequisites
15 +```
16 +npm install
17 +npm install express --save
18 +```
19 +
20 +## Installation
21 +- Clone repo<br>
22 + http://khuhub.khu.ac.kr/2018102224/health_assistant.git
23 +
24 +- MySQL 설치<br>
25 + sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
26 + sudo yum install mysql-community-server
27 + - 서버 자동 시작 설정<br>
28 + sudo systemctl enable mysqld
29 + sudo systemctl start mysqld
30 +
31 + - 서버 실행 여부 확인<br>
32 + sudo systemctl status mysqld
33 +
34 + - mysql root 초기 비밀번호 확인<br>
35 + sudo grep 'A temporary password' /var/log/mysqld.log
36 +
37 + - mysql 접속<br>
38 + mysql -u root -p
39 +
40 +- DB 테이블 생성
41 + - user_info(username, userHeight, userWeight)
42 + - userHealth(username, day, way, part, setNumber, number, breakTime, Id)
43 +
44 +- AWS 도메인 설정
45 + - SSL Certificate
46 +
47 +## Usage
48 +
49 + 1. 로그인 - kakao
50 + 2. 키와 몸무게를 입력
51 + 3. 요일별 운동 루틴 저장
52 + 4. 운동 방법에 대한 설명 (유튜브 링크)
53 + 4. 설정한 쉬는 시간 끝났을 때 팝업 알림
54 + 5. 루틴 추천 기능: 키와 몸무게가 비슷한 다른 유저들의 루틴 참고 가능
55 +
56 +## Roadmap
57 +
58 +- [X] DataStructures
59 +- [X] Add back to top links
60 +- [X] Exception Handling
61 +- [X] Use Cookies
62 +- [X] Encryption
63 +
64 +## Contributing
65 +
66 +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
67 +
68 +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
69 +Don't forget to give the project a star! Thanks again!
70 +
71 +1. Fork the Project
72 +2. Create your Feature Branch
73 +3. Commit your Changes
74 +4. Push to the Branch
75 +5. Open a Pull Request
76 +
77 +## License
78 +- MySQL (https://www.mysql.com/)
79 +- Kakao API (https://developers.kakao.com/docs/latest/ko/kakaologin/common)
80 +
81 +
82 +## Contact
83 +- 임준표 wnsvy1997@gmail.com
84 +
1 +const express = require("express");
2 +const app = express();
3 +const sslport = 23023;
4 +const passport = require("passport");
5 +const index = require("./routes/index");
6 +const user = require("./routes/user");
7 +const path = require("path");
8 +const setup = require("./routes/setup");
9 +const daySelect = require("./routes/daySelect");
10 +const otherUser = require("./routes/otherUser");
11 +const myHealth = require("./routes/myHealth");
12 +
13 +passport.serializeUser(function (user, done) {
14 + console.log("serialized");
15 + done(null, user);
16 +});
17 +passport.deserializeUser(function (user, done) {
18 + console.log("deserialized");
19 + done(null, user);
20 +});
21 +
22 +app.use(express.json());
23 +app.use(express.static(__dirname + "/public"));
24 +
25 +app.set("views", path.join(__dirname, "views"));
26 +app.set("view engine", "ejs");
27 +
28 +app.use(passport.initialize());
29 +app.use("/", index);
30 +app.use("/user", user);
31 +app.use("/setup", setup);
32 +app.use("/daySelect", daySelect);
33 +app.use("/otherUser", otherUser);
34 +app.use("/myHealth", myHealth);
35 +app.use("/static", express.static("./js/"));
36 +
37 +app.listen(sslport, () => {
38 + console.log(`Example app listening at www.2018102224.osschatbot.cf:${sslport}`);
39 + //도메인 입력
40 +});
41 +
42 +module.exports = app;
1 +var target;
2 +
3 +function addressKindChange(e) {
4 + const shoulder = [
5 + "아놀드 프레스",
6 + "래터럴 레이즈",
7 + "프론트 레이즈",
8 + "리버스 펙덱 플라이",
9 + ];
10 + const leg = ["레그프레스", "스쿼트", "런지", "레그 익스텐션", "레그컬"];
11 + const arm = [
12 + "덤벨 컬",
13 + "오버헤드프레스",
14 + "덤벨 킥백",
15 + "라잉 트라이셉스 익스텐션",
16 + ];
17 + const core = ["플랭크", "백 익스텐션", "크런치"];
18 + const breath = ["싸이클", "런닝머신"];
19 + const back = ["랫풀다운", "시티드로우", "바벨로우", "데드리프트", "풀업"];
20 + const chest = ["인클라인 벤치프레스", "벤치프레스", "딥스", "푸쉬업"];
21 + target = document.getElementById("way");
22 +
23 + if (e.value == "어깨") var d = shoulder;
24 + else if (e.value == "하체") var d = leg;
25 + else if (e.value == "이삼두") var d = arm;
26 + else if (e.value == "등") var d = back;
27 + else if (e.value == "유산소") var d = breath;
28 + else if (e.value == "코어") var d = core;
29 + else if (e.value == "가슴") var d = chest;
30 +
31 + target.options.length = 0;
32 +
33 + for (x in d) {
34 + var opt = document.createElement("option");
35 + opt.value = d[x];
36 + opt.innerHTML = d[x];
37 + target.appendChild(opt);
38 + }
39 +}
40 +
41 +function ex1() {
42 + return target;
43 +}
1 +/*!
2 + * Start Bootstrap - Stylish Portfolio v6.0.4 (https://startbootstrap.com/theme/stylish-portfolio)
3 + * Copyright 2013-2021 Start Bootstrap
4 + * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-stylish-portfolio/blob/master/LICENSE)
5 + */
6 +window.addEventListener("DOMContentLoaded", (event) => {
7 + const sidebarWrapper = document.getElementById("sidebar-wrapper");
8 + let scrollToTopVisible = false;
9 + // Closes the sidebar menu
10 + const menuToggle = document.body.querySelector(".menu-toggle");
11 + menuToggle.addEventListener("click", (event) => {
12 + event.preventDefault();
13 + sidebarWrapper.classList.toggle("active");
14 + _toggleMenuIcon();
15 + menuToggle.classList.toggle("active");
16 + });
17 +
18 + // Closes responsive menu when a scroll trigger link is clicked
19 + var scrollTriggerList = [].slice.call(
20 + document.querySelectorAll("#sidebar-wrapper .js-scroll-trigger")
21 + );
22 + scrollTriggerList.map((scrollTrigger) => {
23 + scrollTrigger.addEventListener("click", () => {
24 + sidebarWrapper.classList.remove("active");
25 + menuToggle.classList.remove("active");
26 + _toggleMenuIcon();
27 + });
28 + });
29 +
30 + function _toggleMenuIcon() {
31 + const menuToggleBars = document.body.querySelector(
32 + ".menu-toggle > .fa-bars"
33 + );
34 + const menuToggleTimes = document.body.querySelector(
35 + ".menu-toggle > .fa-times"
36 + );
37 + if (menuToggleBars) {
38 + menuToggleBars.classList.remove("fa-bars");
39 + menuToggleBars.classList.add("fa-times");
40 + }
41 + if (menuToggleTimes) {
42 + menuToggleTimes.classList.remove("fa-times");
43 + menuToggleTimes.classList.add("fa-bars");
44 + }
45 + }
46 +
47 + // Scroll to top button appear
48 + document.addEventListener("scroll", () => {
49 + const scrollToTop = document.body.querySelector(".scroll-to-top");
50 + if (document.documentElement.scrollTop > 100) {
51 + if (!scrollToTopVisible) {
52 + fadeIn(scrollToTop);
53 + scrollToTopVisible = true;
54 + }
55 + } else {
56 + if (scrollToTopVisible) {
57 + fadeOut(scrollToTop);
58 + scrollToTopVisible = false;
59 + }
60 + }
61 + });
62 +});
63 +
64 +function fadeOut(el) {
65 + el.style.opacity = 1;
66 + (function fade() {
67 + if ((el.style.opacity -= 0.1) < 0) {
68 + el.style.display = "none";
69 + } else {
70 + requestAnimationFrame(fade);
71 + }
72 + })();
73 +}
74 +
75 +function fadeIn(el, display) {
76 + el.style.opacity = 0;
77 + el.style.display = display || "block";
78 + (function fade() {
79 + var val = parseFloat(el.style.opacity);
80 + if (!((val += 0.1) > 1)) {
81 + el.style.opacity = val;
82 + requestAnimationFrame(fade);
83 + }
84 + })();
85 +}
1 +var x;
2 +
3 +const onClick = (bt) => {
4 + const onDelete = () => {
5 + clearInterval(x);
6 + document.getElementById("demo").innerText = "";
7 + document.querySelector("#deleteBtn").innerText = "";
8 + document.querySelector("#healthname").innerText = "";
9 + };
10 + const a = document.querySelector("#breaktime").innerText;
11 + var time = parseInt(bt.value);
12 + console.log(bt.name);
13 + console.log(time);
14 + var min = "";
15 + var sec = "";
16 + x = setInterval(function () {
17 + min = parseInt(time / 60);
18 + sec = time % 60;
19 +
20 + document.getElementById("demo").innerHTML = min + ":" + sec + "";
21 + time--;
22 +
23 + if (time < 0) {
24 + clearInterval(x);
25 + document.getElementById("demo").innerHTML = "쉬는시간 끝!";
26 + alert("쉬는시간이 끝났습니다!");
27 + }
28 + }, 1000);
29 + const del_bt = document.querySelector("#deleteBtn");
30 + const healthname = document.querySelector("#healthname");
31 + healthname.innerHTML = bt.name + " 쉬는시간!";
32 + var ex = document.createElement("Button");
33 + ex.innerHTML = "타이머 지우기";
34 + ex.className = "btn btn-dark";
35 + ex.onclick = onDelete;
36 + del_bt.appendChild(ex);
37 +};
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "abcd",
3 + "version": "1.0.0",
4 + "description": "",
5 + "main": "app.js",
6 + "scripts": {
7 + "test": "echo \"Error: no test specified\" && exit 1"
8 + },
9 + "keywords": [],
10 + "author": "",
11 + "license": "ISC",
12 + "dependencies": {
13 + "axios": "^0.24.0",
14 + "body-parser": "^1.19.0",
15 + "ejs": "^3.1.6",
16 + "express": "^4.17.1",
17 + "express-mysql-session": "^2.1.7",
18 + "express-session": "^1.17.2",
19 + "mysql": "^2.18.1",
20 + "passport": "^0.5.0",
21 + "passport-kakao": "^1.0.1"
22 + }
23 +}
This diff could not be displayed because it is too large.
1 +const express = require("express");
2 +const router = express.Router();
3 +const mysql = require("mysql");
4 +
5 +router.use(express.urlencoded({ extended: false }));
6 +
7 +const conn = {
8 + host: "localhost",
9 + port: "3306",
10 + user: "root",
11 + password: "@Binocchio66",
12 + database: "healthassistant",
13 +};
14 +
15 +let testQuery;
16 +
17 +const connection = mysql.createConnection(conn); // DB 커넥션 생성
18 +connection.connect(); // DB접속
19 +
20 +router.get("/", (req, res, next) => {
21 + testQuery = `SELECT * FROM userHealth WHERE username ="${req.user.nickname}"`;
22 + connection.query(testQuery, (err, results, fields) => {
23 + if (!err) {
24 + let myArr_mon = new Array();
25 + let myArr_tue = new Array();
26 + let myArr_wed = new Array();
27 + let myArr_thu = new Array();
28 + let myArr_fri = new Array();
29 + let myArr_sat = new Array();
30 + let myArr_sun = new Array();
31 + for (let i = 0; i < results.length; i++) {
32 + if (results[i].day == "월") {
33 + myArr_mon.push(results[i]);
34 + }
35 + }
36 + for (let i = 0; i < results.length; i++) {
37 + if (results[i].day == "화") {
38 + myArr_tue.push(results[i]);
39 + }
40 + }
41 + for (let i = 0; i < results.length; i++) {
42 + if (results[i].day == "수") {
43 + myArr_wed.push(results[i]);
44 + }
45 + }
46 + for (let i = 0; i < results.length; i++) {
47 + if (results[i].day == "목") {
48 + myArr_thu.push(results[i]);
49 + }
50 + }
51 + for (let i = 0; i < results.length; i++) {
52 + if (results[i].day == "금") {
53 + myArr_fri.push(results[i]);
54 + }
55 + }
56 + for (let i = 0; i < results.length; i++) {
57 + if (results[i].day == "토") {
58 + myArr_sat.push(results[i]);
59 + }
60 + }
61 + for (let i = 0; i < results.length; i++) {
62 + if (results[i].day == "일") {
63 + myArr_sun.push(results[i]);
64 + }
65 + }
66 + res.render("daySelect", {
67 + arr_mon: myArr_mon,
68 + arr_tue: myArr_tue,
69 + arr_wed: myArr_wed,
70 + arr_thu: myArr_thu,
71 + arr_fri: myArr_fri,
72 + arr_sat: myArr_sat,
73 + arr_sun: myArr_sun,
74 + });
75 + } else {
76 + console.log(err);
77 + }
78 + });
79 +});
80 +
81 +
82 +module.exports = router;
1 +const express = require("express");
2 +const router = express.Router();
3 +const passport = require("passport");
4 +const axios = require("axios");
5 +const KakaoStrategy = require("passport-kakao").Strategy;
6 +const session = require("express-session");
7 +const mysql = require("mysql");
8 +
9 +passport.serializeUser(function (user, done) {
10 + // console.log("serialized");
11 + done(null, user);
12 +});
13 +passport.deserializeUser(function (user, done) {
14 + // console.log("deserialized");
15 + done(null, user);
16 +});
17 +
18 +router.use(session({ secret: "anything" }));
19 +router.use(passport.initialize());
20 +router.use(passport.session());
21 +
22 +passport.use(
23 + "kakao-login",
24 + new KakaoStrategy(
25 + {
26 + clientID: "359a37c3d9b0bec98aab1f2882447b24",
27 + callbackURL: "/auth/kakao/callback",
28 + clientSecret: "XvRp0bV6dZ8aj9f7ApYCT0ZoeDEL9cGi",
29 + },
30 + async (accessToken, refreshToken, profile, done) => {
31 + console.log(accessToken);
32 + console.log(profile);
33 + return done(null, {
34 + //req.user가 되는 부분
35 + user_id: profile._json.id,
36 + nickname: profile._json.properties.nickname,
37 + });
38 + }
39 + )
40 +);
41 +router.get("/", (req, res) => {
42 + res.render("index", {
43 + title: "안녕하세요",
44 + });
45 +});
46 +
47 +router.get("/auth/kakao", passport.authenticate("kakao-login"));
48 +
49 +router.get(
50 + "/auth/kakao/callback",
51 + passport.authenticate("kakao-login", {
52 + failureRedirect: "/failure",
53 + }),
54 + (req, res) => {
55 + res.redirect("/user");
56 + }
57 +);
58 +
59 +router.get("/auth/logout/kakao", function (req, res) {
60 + req.logout();
61 + res.redirect("/");
62 +});
63 +
64 +module.exports = router;
1 +const express = require("express");
2 +const router = express.Router();
3 +const mysql = require("mysql");
4 +
5 +router.use(express.urlencoded({ extended: false }));
6 +
7 +const conn = {
8 + host: "localhost",
9 + port: "3306",
10 + user: "root",
11 + password: "@Binocchio66",
12 + database: "healthassistant",
13 +};
14 +
15 +let testQuery;
16 +
17 +const connection = mysql.createConnection(conn); // DB 커넥션 생성
18 +connection.connect(); // DB접속
19 +
20 +router.get("/", (req, res) => {
21 + testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
22 + connection.query(testQuery, (err, results, field) => {
23 + if (err) {
24 + console.log(err);
25 + } else {
26 + console.log(results);
27 + res.render("myHealth", {
28 + arr1: results,
29 + });
30 + }
31 + });
32 +});
33 +
34 +module.exports = router;
1 +const express = require("express");
2 +const router = express.Router();
3 +const mysql = require("mysql");
4 +
5 +router.use(express.urlencoded({ extended: false }));
6 +
7 +const conn = {
8 + host: "localhost",
9 + port: "3306",
10 + user: "root",
11 + password: "@Binocchio66",
12 + database: "healthassistant",
13 +};
14 +
15 +let testQuery;
16 +
17 +const connection = mysql.createConnection(conn); // DB 커넥션 생성
18 +connection.connect(); // DB접속
19 +
20 +router.get("/", (req, res) => {
21 + testQuery = `SELECT * FROM user_info WHERE username="${req.user.nickname}"`;
22 + connection.query(testQuery, (err, results, fields) => {
23 + if (!err) {
24 + const userHeight = results[0].userHeight;
25 + const userWeight = results[0].userWeight;
26 + testQuery = `SELECT * FROM user_info WHERE userWeight <= (${userWeight} + 5) and userWeight >= (${userWeight} -5 ) and userHeight <= (${userHeight} +5) and userHeight >= (${userHeight} -5) and username != "${req.user.nickname}" `;
27 + connection.query(testQuery, (err, results, fields) => {
28 + if (err) {
29 + console.log(err);
30 + } else {
31 + res.render("otherUser", {
32 + userlist: results,
33 + });
34 + }
35 + });
36 + }
37 + });
38 +});
39 +
40 +router.get("/show/:username", (req, res) => {
41 + const username = req.params.username;
42 + testQuery = `SELECT * FROM userHealth WHERE username = "${username}"`;
43 + connection.query(testQuery, (err, results, field) => {
44 + if (err) {
45 + console.log(err);
46 + } else {
47 + res.render("otherHealth", {
48 + arr1: results,
49 + username: username,
50 + });
51 + }
52 + });
53 +});
54 +
55 +module.exports = router;
1 +const express = require("express");
2 +const router = express.Router();
3 +const mysql = require("mysql");
4 +const test = require("../js/examples");
5 +
6 +const conn = {
7 + host: "localhost",
8 + port: "3306",
9 + user: "root",
10 + password: "@Binocchio66",
11 + database: "healthassistant",
12 +};
13 +
14 +let day, day_eng;
15 +let myArr, myArr2;
16 +let cnt = 0;
17 +
18 +const connection = mysql.createConnection(conn); // DB 커넥션 생성
19 +connection.connect(); // DB접속
20 +
21 +router.use(express.urlencoded({ extended: false }));
22 +
23 +router.get("/", (req, res, next) => {
24 + res.render("setup");
25 +});
26 +
27 +router.post("/", (req, res, next) => {
28 + let testQuery = `INSERT INTO userHealth (username, day, way, part, setNumber, number, breakTime, Id) VALUES ("${req.user.nickname}", "${req.body.day}","${req.body.way}","${req.body.part}","${req.body.setNumber}","${req.body.number}","${req.body.breakTime}","${cnt}")`;
29 + cnt++;
30 + connection.query(testQuery, (err, results, fields) => {
31 + //results에 배열로 db값이 저장됨.
32 + if (err) {
33 + console.log(err);
34 + }
35 + });
36 + res.redirect("/daySelect");
37 +});
38 +
39 +router.get("/Monday", (req, res, next) => {
40 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
41 + connection.query(testQuery, (err, results, fields) => {
42 + if (!err) {
43 + day = "월";
44 + day_eng = "Monday";
45 + myArr = new Array();
46 + myArr2 = new Array();
47 + for (let i = 0; i < results.length; i++) {
48 + if (results[i].day == "월") {
49 + myArr2.push(results[i]);
50 + }
51 + }
52 + for (let i = 0; i < results.length; i++) {
53 + myArr.push(results[i].day);
54 + }
55 + if (myArr.findIndex((e) => e === "월") !== -1) {
56 + console.log("월요일 루틴이 있습니다.");
57 + res.render("startHealth", {
58 + day: "월",
59 + arr1: myArr2,
60 + });
61 + } else {
62 + console.log("월요일 루틴이 없습니다.");
63 + res.render("setup");
64 + }
65 + } else {
66 + console.log(err);
67 + }
68 + });
69 +});
70 +
71 +router.get("/Tuesday", (req, res, next) => {
72 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
73 + connection.query(testQuery, (err, results, fields) => {
74 + if (!err) {
75 + day = "화";
76 + day_eng = "Tuesday";
77 + myArr = new Array();
78 + myArr2 = new Array();
79 + for (let i = 0; i < results.length; i++) {
80 + if (results[i].day == "화") {
81 + myArr2.push(results[i]);
82 + }
83 + }
84 + for (let i = 0; i < results.length; i++) {
85 + myArr.push(results[i].day);
86 + }
87 + if (myArr.findIndex((e) => e === "화") !== -1) {
88 + console.log("화요일 루틴이 있습니다.");
89 + res.render("startHealth", {
90 + day: "화",
91 + arr1: myArr2,
92 + });
93 + } else {
94 + console.log("화요일 루틴이 없습니다.");
95 + res.render("setup");
96 + }
97 + } else {
98 + console.log(err);
99 + }
100 + });
101 +});
102 +
103 +router.get("/Wednesday", (req, res, next) => {
104 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
105 + connection.query(testQuery, (err, results, fields) => {
106 + if (!err) {
107 + day = "수";
108 + day_eng = "Wednesday";
109 + myArr = new Array();
110 + myArr2 = new Array();
111 + for (let i = 0; i < results.length; i++) {
112 + if (results[i].day == "수") {
113 + myArr2.push(results[i]);
114 + }
115 + }
116 + for (let i = 0; i < results.length; i++) {
117 + myArr.push(results[i].day);
118 + }
119 + if (myArr.findIndex((e) => e === "수") !== -1) {
120 + console.log("수요일 루틴이 있습니다.");
121 + res.render("startHealth", {
122 + day: "수",
123 + arr1: myArr2,
124 + });
125 + } else {
126 + console.log("수요일 루틴이 없습니다.");
127 + res.render("setup");
128 + }
129 + } else {
130 + console.log(err);
131 + }
132 + });
133 +});
134 +
135 +router.get("/Thursday", (req, res, next) => {
136 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
137 + connection.query(testQuery, (err, results, fields) => {
138 + if (!err) {
139 + day = "목";
140 + day_eng = "Thursday";
141 + myArr = new Array();
142 + myArr2 = new Array();
143 + for (let i = 0; i < results.length; i++) {
144 + if (results[i].day == "목") {
145 + myArr2.push(results[i]);
146 + }
147 + }
148 + for (let i = 0; i < results.length; i++) {
149 + myArr.push(results[i].day);
150 + }
151 + if (myArr.findIndex((e) => e === "목") !== -1) {
152 + console.log("목요일 루틴이 있습니다.");
153 + res.render("startHealth", {
154 + day: "목",
155 + arr1: myArr2,
156 + });
157 + } else {
158 + console.log("목요일 루틴이 없습니다.");
159 + res.render("setup");
160 + }
161 + } else {
162 + console.log(err);
163 + }
164 + });
165 +});
166 +
167 +router.get("/Friday", (req, res, next) => {
168 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
169 + connection.query(testQuery, (err, results, fields) => {
170 + if (!err) {
171 + day = "금";
172 + day_eng = "Friday";
173 + myArr = new Array();
174 + myArr2 = new Array();
175 + for (let i = 0; i < results.length; i++) {
176 + if (results[i].day == "금") {
177 + myArr2.push(results[i]);
178 + }
179 + }
180 + for (let i = 0; i < results.length; i++) {
181 + myArr.push(results[i].day);
182 + }
183 + if (myArr.findIndex((e) => e === "금") !== -1) {
184 + console.log("금요일 루틴이 있습니다.");
185 + res.render("startHealth", {
186 + day: "금",
187 + arr1: myArr2,
188 + });
189 + } else {
190 + console.log("금요일 루틴이 없습니다.");
191 + res.render("setup");
192 + }
193 + } else {
194 + console.log(err);
195 + }
196 + });
197 +});
198 +
199 +router.get("/Saturday", (req, res, next) => {
200 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
201 + connection.query(testQuery, (err, results, fields) => {
202 + if (!err) {
203 + day = "토";
204 + day_eng = "Saturday";
205 + myArr = new Array();
206 + myArr2 = new Array();
207 + for (let i = 0; i < results.length; i++) {
208 + if (results[i].day == "토") {
209 + myArr2.push(results[i]);
210 + }
211 + }
212 + for (let i = 0; i < results.length; i++) {
213 + myArr.push(results[i].day);
214 + }
215 + if (myArr.findIndex((e) => e === "토") !== -1) {
216 + console.log("토요일 루틴이 있습니다.");
217 + res.render("startHealth", {
218 + day: "토",
219 + arr1: myArr2,
220 + });
221 + } else {
222 + console.log("토요일 루틴이 없습니다.");
223 + res.render("setup");
224 + }
225 + } else {
226 + console.log(err);
227 + }
228 + });
229 +});
230 +
231 +router.get("/Sunday", (req, res, next) => {
232 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
233 + connection.query(testQuery, (err, results, fields) => {
234 + if (!err) {
235 + day = "일";
236 + day_eng = "Sunday";
237 + myArr = new Array();
238 + myArr2 = new Array();
239 + for (let i = 0; i < results.length; i++) {
240 + if (results[i].day == "일") {
241 + myArr2.push(results[i]);
242 + }
243 + }
244 + for (let i = 0; i < results.length; i++) {
245 + myArr.push(results[i].day);
246 + }
247 + if (myArr.findIndex((e) => e === "일") !== -1) {
248 + console.log("일요일 루틴이 있습니다.");
249 + res.render("startHealth", {
250 + day: "일",
251 + arr1: myArr2,
252 + });
253 + } else {
254 + console.log("일요일 루틴이 없습니다.");
255 + res.render("setup");
256 + }
257 + } else {
258 + console.log(err);
259 + }
260 + });
261 +});
262 +
263 +router.get("/remove/:Id", (req, res, next) => {
264 + let testQuery = `SELECT * FROM userHealth WHERE username = "${req.user.nickname}"`;
265 + const Id = req.params.Id;
266 + connection.query(testQuery, (err, results, fields) => {
267 + if (!err) {
268 + myArr = new Array();
269 + for (let i = 0; i < results.length; i++) {
270 + if (results[i].day == day) {
271 + myArr.push(results[i]);
272 + }
273 + }
274 + testQuery = `DELETE FROM userHealth WHERE id = ${Id}`;
275 + connection.query(testQuery, (err, results, fields) => {
276 + if (!err) {
277 + res.send(
278 + `<script>alert("삭제 완료!"); location.href='/setup/${day_eng}';</script>`
279 + );
280 + } else {
281 + console.log(err);
282 + }
283 + });
284 + } else {
285 + console.log(err);
286 + }
287 + });
288 +});
289 +
290 +router.get("/edit/:Id", (req, res, next) => {
291 + res.render("editHealth", {
292 + day: day,
293 + arr1: myArr2,
294 + Id: req.params.Id,
295 + });
296 +});
297 +
298 +router.post("/edit/:Id", (req, res, next) => {
299 + const Id = req.params.Id;
300 + let testQuery = `UPDATE userHealth SET way="${req.body.way}", part="${req.body.part}", setNumber="${req.body.setNumber}", number="${req.body.number}", breakTime="${req.body.breakTime}" WHERE way = "${Id}"`;
301 + connection.query(testQuery, (err, results, field) => {
302 + if (!err) {
303 + console.log("수정완료!");
304 + res.redirect(`/setup/${day_eng}`);
305 + } else {
306 + console.log(err);
307 + }
308 + });
309 +});
310 +
311 +module.exports = router;
1 +const express = require("express");
2 +const router = express.Router();
3 +const mysql = require("mysql");
4 +
5 +const conn = {
6 + host: "localhost",
7 + port: "3306",
8 + user: "root",
9 + password: "@Binocchio66",
10 + database: "healthassistant",
11 +};
12 +
13 +const connection = mysql.createConnection(conn); // DB 커넥션 생성
14 +connection.connect(); // DB접속
15 +
16 +router.use(express.urlencoded({ extended: false }));
17 +
18 +router.get("/", (req, res, next) => {
19 + console.log("로그인 성공!");
20 +
21 + let testQuery = `SELECT * FROM user_info WHERE username="${req.user.nickname}"`;
22 +
23 + connection.query(testQuery, (err, results, fields) => {
24 + if (results.length == 0) {
25 + res.render("user", {
26 + title: "정보 입력",
27 + });
28 + } else {
29 + console.log("정보가 있는 유저입니다.");
30 + res.redirect("/daySelect");
31 + }
32 + });
33 +});
34 +
35 +router.post("/", (req, res) => {
36 + const height = req.body.height;
37 + const weight = req.body.weight;
38 +
39 + let testQuery = `INSERT INTO user_info (username, userHeight, userWeight) values ("${req.user.nickname}", ${height}, ${weight})`;
40 + // let testQuery = `INSERT INTO 'user_info' ('username', 'userHeight)`;
41 +
42 + connection.query(testQuery, (err, results, fields) => {
43 + if (err) {
44 + console.log(err);
45 + }
46 + });
47 + res.redirect("/daySelect");
48 + // res.redirect("/");
49 +});
50 +
51 +module.exports = router;
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>Setup</title>
6 + <link
7 + href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
8 + rel="stylesheet"
9 + />
10 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
11 + <!-- Font Awesome icons (free version)-->
12 + <script
13 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
14 + crossorigin="anonymous"
15 + ></script>
16 + <!-- Simple line icons-->
17 + <link
18 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
19 + rel="stylesheet"
20 + />
21 + <!-- Google fonts-->
22 + <link
23 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
24 + rel="stylesheet"
25 + type="text/css"
26 + />
27 + <link rel="preconnect" href="https://fonts.googleapis.com" />
28 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
29 + <link
30 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Gowun+Dodum&family=Do+Hyeon&family=Jua&family=Anton&family=Fuzzy+Bubbles:wght@700&display=swap"
31 + rel="stylesheet"
32 + />
33 + <link rel="stylesheet" href="/stylesheets/styles.css" />
34 + <style>
35 + .title-fontA {
36 + font-family: 'Fuzzy Bubbles', cursive;
37 + }
38 + .title-fontB {
39 + font-family: 'Anton', sans-serif;
40 + }
41 + .day-fontA {
42 + font-family: 'Gowun Dodum', sans-serif;
43 + font-size: 35px;
44 + color: black;
45 + }
46 + </style>
47 + </head>
48 + <body>
49 + <div class="navbar navbar-expand-lg navbar-light bgtop">
50 + <div class="container text-center mx-4 my-1">
51 + <a class="navbar-brand title-fontA" href="/daySelect">Health Assistant</a>
52 + </div>
53 + <div class="mx-3">
54 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
55 + </div>
56 + <div class="mx-3">
57 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
58 + </div>
59 + <div class="mx-3">
60 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
61 + </div>
62 + </div>
63 + <div class="container">
64 + <div class="row row-cols-1 row-cols-md-4 g-4 mt-4">
65 + <div class="col">
66 + <a href="/setup/Monday">
67 + <div class="card" style="width: 75%">
68 + <div class="card-body">
69 + <h5 class="card-title text-center day-fontA">월요일</h5>
70 + <p class="card-text">
71 +
72 + <% if(arr_mon.length ==0) { %>
73 + <p>월요일 운동이 없습니다! </p>
74 + <% } else { %>
75 + <ul>
76 + <li><%= arr_mon[0].way %></li>
77 + </ul>
78 + <% } %>
79 +
80 + </p>
81 + </div>
82 + </div>
83 + </a>
84 + </div>
85 + <div class="col">
86 + <a href="/setup/Tuesday">
87 + <div class="card" style="width: 75%">
88 + <div class="card-body">
89 + <h5 class="card-title text-center day-fontA">화요일</h5>
90 + <p class="card-text">
91 + <% if(arr_tue.length ==0) { %>
92 + <p>화요일 운동이 없습니다!</p>
93 + <% } else { %>
94 + <ul>
95 + <li><%= arr_tue[0].way %></li>
96 + </ul>
97 + <% } %>
98 + </p>
99 + </div>
100 + </div>
101 + </a>
102 + </div>
103 + <div class="col">
104 + <a href="/setup/Wednesday">
105 + <div class="card" style="width: 75%">
106 + <div class="card-body">
107 + <h5 class="card-title text-center day-fontA">수요일</h5>
108 + <p class="card-text">
109 + <% if(arr_wed.length ==0) { %>
110 + <p>수요일 운동이 없습니다!</p>
111 + <% } else { %>
112 + <ul>
113 + <li><%= arr_wed[0].way %></li>
114 + </ul>
115 + <% } %>
116 + </ul>
117 + </p>
118 + </div>
119 + </div>
120 + </a>
121 + </div>
122 + <div class="col">
123 + <a href="/setup/Thursday">
124 + <div class="card" style="width: 75%">
125 + <div class="card-body">
126 + <h5 class="card-title text-center day-fontA">목요일</h5>
127 + <p class="card-text">
128 +
129 + <% if(arr_thu.length ==0) { %>
130 + <p>목요일 운동이 없습니다!</p>
131 + <% } else { %>
132 + <ul>
133 + <li><%= arr_thu[0].way %></li>
134 + </ul>
135 + <% } %>
136 +
137 + </p>
138 + </div>
139 + </div>
140 + </a>
141 + </div>
142 + <div class="col">
143 + <a href="/setup/Friday">
144 + <div class="card mt-5" style="width: 75%">
145 + <div class="card-body">
146 + <h5 class="card-title text-center day-fontA">금요일</h5>
147 + <p class="card-text">
148 +
149 + <% if(arr_fri.length ==0) { %>
150 + <p>금요일 운동이 없습니다!</p>
151 + <% } else { %>
152 + <ul>
153 + <li><%= arr_fri[0].way %></li>
154 + </ul>
155 + <% } %>
156 +
157 + </p>
158 + </div>
159 + </div>
160 + </a>
161 + </div>
162 + <div class="col">
163 + <a href="/setup/Saturday">
164 + <div class="card mt-5" style="width: 75%">
165 + <div class="card-body">
166 + <h5 class="card-title text-center day-fontA">토요일</h5>
167 + <p class="card-text">
168 +
169 + <% if(arr_sat.length ==0) { %>
170 + <p>토요일 운동이 없습니다!</p>
171 + <% } else { %>
172 + <ul>
173 + <li><%= arr_sat[0].way %></li>
174 + </ul>
175 + <% } %>
176 + </p>
177 + </div>
178 + </div>
179 + </a>
180 + </div>
181 + <div class="col">
182 + <a href="setup/Sunday">
183 + <div class="card mt-5" style="width: 75%">
184 + <div class="card-body">
185 + <h5 class="card-title text-center day-fontA">일요일</h5>
186 + <p class="card-text">
187 +
188 + <% if(arr_sun.length ==0) { %>
189 + <p>일요일 운동이 없습니다!</p>
190 + <% } else { %>
191 + <ul>
192 + <li><%= arr_sun[0].way %></li>
193 + </ul>
194 + <% } %>
195 + </p>
196 + </div>
197 + </div>
198 + </a>
199 + </div>
200 + </div>
201 + </div>
202 +
203 +
204 +
205 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
206 + <script src="/static/scripts.js"></script>
207 + </body>
208 +</html>
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title><%= day %>요일 운동 시작!</title>
6 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
7 + <!-- Font Awesome icons (free version)-->
8 + <script
9 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
10 + crossorigin="anonymous"
11 + ></script>
12 + <!-- Simple line icons-->
13 + <link
14 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
15 + rel="stylesheet"
16 + />
17 + <!-- Google fonts-->
18 + <link
19 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
20 + rel="stylesheet"
21 + type="text/css"
22 + />
23 + <!-- Core theme CSS (includes Bootstrap)-->
24 + <link rel="preconnect" href="https://fonts.googleapis.com" />
25 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
26 + <link
27 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Anton&family=Jua&family=Fuzzy+Bubbles:wght@700&display=swap"
28 + rel="stylesheet"
29 + />
30 + <link rel="stylesheet" href="/stylesheets/styles.css" />
31 + <style>
32 + .title-fontA {
33 + font-family: 'Fuzzy Bubbles', cursive;
34 + }
35 + .title-fontB {
36 + font-family: 'Anton', sans-serif;
37 + }
38 + .day-fontB {
39 + font-family: 'Jua';
40 + }
41 + </style>
42 + </head>
43 +
44 + <body>
45 + <div class="navbar navbar-expand-lg navbar-light bgtop">
46 + <div class="container text-center mx-4 my-1">
47 + <a class="navbar-brand title-fontA" href="/daySelect">Health Assistant</a>
48 + </div>
49 + <div class="mx-3">
50 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
51 + </div>
52 + <div class="mx-3">
53 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
54 + </div>
55 + <div class="mx-3">
56 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
57 + </div>
58 + </div>
59 + <section class="container">
60 + <div>
61 + <h1 class="day-fontB mt-5 text-center"><%= day%>요일 운동 수정</h1>
62 + </div>
63 + <div class="mt-5">
64 + <table class="table text-center">
65 + <tr>
66 + <th>운동 방법</th>
67 + <th>자극 부위</th>
68 + <th>세트</th>
69 + <th>횟수</th>
70 + <th>쉬는시간(초)</th>
71 + <th></th>
72 + <th></th>
73 + </tr>
74 +
75 + <% for(let i=0; i <arr1.length ;i++) {
76 + %>
77 + <% if(arr1[i].way == Id) { %>
78 + <tr>
79 + <form method="POST" action="" id="editForm">
80 + <td><input class="w-40" type="text" name="way" /></td>
81 + <td><input class="w-40" type="text" name="part" /></td>
82 + <td><input class="w-40" type="text" name="setNumber" /></td>
83 + <td><input class="w-40" type="text" name="number" /></td>
84 + <td><input class="w-40" type="text" name="breakTime" /></td>
85 + <td><button class="btn" type="submit"><i class="far fa-check-circle"></i></button></td>
86 + <td></td>
87 + </form>
88 + </tr>
89 + <% } else {%>
90 + <div>
91 + <tr>
92 + <td><%= arr1[i].way %></td>
93 + <td><%= arr1[i].part %></td>
94 + <td><%= arr1[i].setNumber %></td>
95 + <td><%= arr1[i].number %></td>
96 + <td><%= arr1[i].breakTime %></td>
97 + <td></td>
98 + <td></td>
99 + </tr>
100 + </div>
101 + <% }} %>
102 + </table>
103 + </div>
104 +</section>
105 +
106 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
107 + <script src="/static/scripts.js"></script>
108 + </body>
109 +</html>
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>Health Assistant</title>
6 + <link
7 + href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
8 + rel="stylesheet"
9 + />
10 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
11 + <!-- Font Awesome icons (free version)-->
12 + <script
13 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
14 + crossorigin="anonymous"
15 + ></script>
16 + <!-- Simple line icons-->
17 + <link
18 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
19 + rel="stylesheet"
20 + />
21 + <!-- Google fonts-->
22 + <link
23 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
24 + rel="stylesheet"
25 + type="text/css"
26 + />
27 + <link rel="preconnect" href="https://fonts.googleapis.com" />
28 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
29 + <link
30 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Fuzzy+Bubbles:wght@700&display=swap"
31 + rel="stylesheet"
32 + />
33 + <link rel="stylesheet" href="/stylesheets/styles.css" />
34 + <style>
35 + .title-fontA {
36 + font-family: "Fuzzy Bubbles", cursive;
37 + }
38 + </style>
39 + </head>
40 + <body id="page-top">
41 + <nav id="sidebar-wrapper">
42 + <ul class="sidebar-nav">
43 + <li class="sidebar-brand"><a href="#page-top">Health Assistant</a></li>
44 + <li class="sidebar-nav-item"><a href="#page-top">Home</a></li>
45 + <li class="sidebar-nav-item"><a href="#about">About</a></li>
46 + <li class="sidebar-nav-item"><a href="#features">Services</a></li>
47 + </ul>
48 + </nav>
49 + <div class="navbar navbar-expand-lg navbar-light fixed-top">
50 + <a class="menu-toggle rounded" href="#"><i class="fas fa-bars"></i></a>
51 + <div class="container mx-4 my-1">
52 + <a class="navbar-brand title-fontA" href="#page-top"
53 + >Health Assistant</a
54 + >
55 + </div>
56 + </div>
57 +
58 + <!-- Header-->
59 + <header class="masthead d-flex align-items-center">
60 + <div class="container px-4 px-lg-5 text-center">
61 + <h1 class="mb-1">Health Assitant</h1>
62 + <h3 class="mb-5"><em>헬스 관리 쉽게하자!</em></h3>
63 + <a class="btn btn-dark btn-xl" href="/auth/kakao">카카오로 시작하기</a>
64 + </div>
65 + </header>
66 + <section class="content-section bg-light" id="about">
67 + <div class="container px-4 px-lg-5 text-center">
68 + <div class="row gx-4 gx-lg-5 justify-content-center">
69 + <div class="col-lg-4">
70 + <h2 class="mb-3">Programmers</h2>
71 + <p class="lead mb-5">2018102224 임준표</p>
72 + </div>
73 + <div class="col-lg-4">
74 + <h2 class="mb-3">Introduction</h2>
75 + <p class="lead mb-5">
76 + Health Assistant is a Web based program for Daily exercisers.
77 + </p>
78 + </div>
79 + <div class="col-lg-5 mt-1">
80 + <a class="btn btn-dark btn-xl" href="#features">Features</a>
81 + </div>
82 + </div>
83 + </div>
84 + </section>
85 +
86 + <section
87 + class="content-section bg-primary text-white text-center"
88 + id="features"
89 + >
90 + <div class="container px-4 px-lg-5">
91 + <div class="content-section-heading">
92 + <h3 class="text-secondary mb-0 title-fontA">Health Assistant</h3>
93 + <h2 class="mb-5">Features</h2>
94 + </div>
95 + <div class="row gx-4 gx-lg-5">
96 + <div class="col-lg-4 col-md-6 mb-5 mb-lg-0">
97 + <span class="service-icon rounded-circle mx-auto mb-3">
98 + <i class="fas fa-cogs"></i>
99 + </span>
100 + <h4><strong>효율성</strong></h4>
101 + <p class="text-faded mb-0">
102 + 요일별 부위와 운동을 정리해 <br />효율적으로 볼 수 있습니다!
103 + </p>
104 + </div>
105 + <div class="col-lg-4 col-md-0 mb-0 mb-lg-0">
106 + <span class="service-icon rounded-circle mx-auto mb-3">
107 + <div>
108 + <i class="fas fa-clock"></i>
109 + </div>
110 + </span>
111 + <h4><strong>시간관리</strong></h4>
112 + <p class="text-faded mb-0">
113 + 타이머를 통해 쉬는시간을 <br />확실하게 알 수 있습니다!
114 + </p>
115 + </div>
116 + <div class="col-lg-4 col-md-0 mb-0 mb-md-0">
117 + <span class="service-icon rounded-circle mx-auto mb-3">
118 + <i class="far fa-user-circle"></i>
119 + </span>
120 + <h4><strong>루틴추천</strong></h4>
121 + <p class="text-faded mb-0">
122 + 나와 비슷한 체형인 <br />다른사람의 루틴을 볼 수 있습니다!
123 + </p>
124 + </div>
125 + </div>
126 + </div>
127 + </section>
128 +
129 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
130 + <script src="/static/scripts.js"></script>
131 + </body>
132 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>내 운동 목록</title>
6 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
7 + <!-- Font Awesome icons (free version)-->
8 + <script
9 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
10 + crossorigin="anonymous"
11 + ></script>
12 + <!-- Simple line icons-->
13 + <link
14 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
15 + rel="stylesheet"
16 + />
17 + <!-- Google fonts-->
18 + <link
19 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
20 + rel="stylesheet"
21 + type="text/css"
22 + />
23 + <!-- Core theme CSS (includes Bootstrap)-->
24 + <link rel="preconnect" href="https://fonts.googleapis.com" />
25 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
26 + <link
27 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Jua&family=Anton&family=Fuzzy+Bubbles:wght@700&display=swap"
28 + rel="stylesheet"
29 + />
30 + <link rel="stylesheet" href="/stylesheets/styles.css" />
31 + <style>
32 + .title-fontA {
33 + font-family: 'Fuzzy Bubbles', cursive;
34 + }
35 + .title-fontB {
36 + font-family: 'Anton', sans-serif;
37 + }
38 + .day-fontB {
39 + font-family: 'Jua';
40 + }
41 + .table-title {
42 + color: pink;
43 + font-size: 20px;
44 + }
45 + </style>
46 +
47 + </head>
48 +
49 + <body>
50 + <div class="navbar navbar-expand-lg navbar-light bgtop">
51 + <div class="container text-center mx-4 my-1">
52 + <a class="navbar-brand title-fontA" href="/daySelect">Health Assistant</a>
53 + </div>
54 + <div class="mx-3">
55 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
56 + </div>
57 + <div class="mx-3">
58 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
59 + </div>
60 + <div class="mx-3">
61 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
62 + </div>
63 + </div>
64 + <section class="container">
65 + <div>
66 + <h1 class="mt-5 text-center day-fontB">내 운동 목록</h1>
67 + </div>
68 + <div class="mt-5">
69 + <table class="table text-center">
70 + <tr class="table-title">
71 + <th>운동 방법</th>
72 + <th>자극 부위</th>
73 + <th>세트</th>
74 + <th>횟수</th>
75 + <th>쉬는시간(초)</th>
76 + </tr>
77 + <div>
78 + <% for(let i=0; i <arr1.length ;i++) {
79 + %>
80 + <tr>
81 + <td><%= arr1[i].way %></td>
82 + <td><%= arr1[i].part %></td>
83 + <td><%= arr1[i].setNumber %></td>
84 + <td><%= arr1[i].number %></td>
85 + <td><%= arr1[i].breakTime %></td>
86 + </tr>
87 + <% } %>
88 + </div>
89 + </table>
90 + </div>
91 + <div>
92 + <button class="btn btn-lg" onclick="location.href='/setup'" style="float: right;"><i class="fas fa-plus"></i> 추가</button>
93 + </div>
94 +
95 + </section>
96 +
97 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
98 + </body>
99 +</html>
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>내 운동 목록</title>
6 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
7 + <!-- Font Awesome icons (free version)-->
8 + <script
9 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
10 + crossorigin="anonymous"
11 + ></script>
12 + <!-- Simple line icons-->
13 + <link
14 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
15 + rel="stylesheet"
16 + />
17 + <!-- Google fonts-->
18 + <link
19 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
20 + rel="stylesheet"
21 + type="text/css"
22 + />
23 + <!-- Core theme CSS (includes Bootstrap)-->
24 + <link rel="preconnect" href="https://fonts.googleapis.com" />
25 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
26 + <link
27 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Jua&family=Anton&family=Fuzzy+Bubbles:wght@700&display=swap"
28 + rel="stylesheet"
29 + />
30 + <link rel="stylesheet" href="/stylesheets/styles.css" />
31 + <style>
32 + .title-fontA {
33 + font-family: 'Fuzzy Bubbles', cursive;
34 + }
35 + .title-fontB {
36 + font-family: 'Anton', sans-serif;
37 + }
38 + .table-title {
39 + color: pink;
40 + font-size: 20px;
41 + }
42 + .otheruser {
43 + font-family: 'Jua', sans-serif;
44 + }
45 + </style>
46 + </head>
47 +
48 + <body>
49 + <div class="navbar navbar-expand-lg navbar-light bgtop">
50 + <div class="container text-center mx-4 my-1">
51 + <a class="navbar-brand title-fontA" href="/daySelect">Health Assistant</a>
52 + </div>
53 + <div class="mx-3">
54 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
55 + </div>
56 + <div class="mx-3">
57 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
58 + </div>
59 + <div class="mx-3">
60 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
61 + </div>
62 + </div>
63 + <section class="container">
64 + <div>
65 + <h1 class="otheruser mt-5 text-center"><%= username[0] %>**의 운동 목록</h1>
66 + </div>
67 + <% if(arr1.length == 0) { %>
68 + <h2 class="text-center mt-5"><%= username[0] %>**님의 운동목록이 없습니다!</h2>
69 + <% } else { %>
70 + <div class="mt-5">
71 + <table class="table text-center">
72 + <tr class="table-title">
73 + <th>운동 방법</th>
74 + <th>자극 부위</th>
75 + <th>세트</th>
76 + <th>횟수</th>
77 + <th>쉬는시간(초)</th>
78 + </tr>
79 +
80 + <div>
81 +
82 + <% for(let i=0; i <arr1.length ;i++) {
83 + %>
84 + <tr>
85 + <td><%= arr1[i].way %></td>
86 + <td><%= arr1[i].part %></td>
87 + <td><%= arr1[i].setNumber %></td>
88 + <td><%= arr1[i].number %></td>
89 + <td><%= arr1[i].breakTime %></td>
90 + </tr>
91 + <% } %>
92 + </div>
93 + <% } %>
94 +
95 +
96 + </table>
97 + </div>
98 +
99 + </section>
100 +
101 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
102 + </body>
103 +</html>
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>Document</title>
6 + <link
7 + href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
8 + rel="stylesheet"
9 + />
10 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
11 + <!-- Font Awesome icons (free version)-->
12 + <script
13 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
14 + crossorigin="anonymous"
15 + ></script>
16 + <!-- Simple line icons-->
17 + <link
18 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
19 + rel="stylesheet"
20 + />
21 + <!-- Google fonts-->
22 + <link
23 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
24 + rel="stylesheet"
25 + type="text/css"
26 + />
27 + <link rel="preconnect" href="https://fonts.googleapis.com" />
28 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
29 + <link
30 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Jua&family=Anton&family=Fuzzy+Bubbles:wght@700&display=swap"
31 + rel="stylesheet"
32 + />
33 + <link rel="stylesheet" href="/stylesheets/styles.css" />
34 + <style>
35 + .title-fontA {
36 + font-family: 'Fuzzy Bubbles', cursive;
37 + }
38 + .title-fontB {
39 + font-family: 'Anton', sans-serif;
40 + }
41 + .noneuser {
42 + font-family: 'Jua', sans-serif;
43 + }
44 + </style>
45 + </head>
46 + <body>
47 + <div class="navbar navbar-expand-lg navbar-light bgtop">
48 + <div class="container text-center mx-4 my-1">
49 + <a class="navbar-brand title-fontA" href="/daySelect">Health Assistant</a>
50 + </div>
51 + <div class="mx-3">
52 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
53 + </div>
54 + <div class="mx-3">
55 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
56 + </div>
57 + <div class="mx-3">
58 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
59 + </div>
60 + </div>
61 + <div class="container">
62 + <% if(userlist.length ==0) { %>
63 + <div class="mt-5 text-center noneuser">
64 + <h1>비슷한 체형의 사용자가 없습니다!</h1>
65 + </div>
66 + <% } else { %>
67 + <div class="row row-cols-1 row-cols-md-4 g-4 mt-4">
68 +
69 + <% for(let i =0; i <userlist.length; i++) { %>
70 + <div class="col">
71 + <a href="/otherUser/show/<%= userlist[i].username %>">
72 + <div class="card" style="width: 75%">
73 + <div class="card-body">
74 + <h5 class="card-title text-center">
75 + <%= userlist[i].username[0] %>**
76 + </h5>
77 + <p class="card-text"></p>
78 + <p><%= userlist[i].userHeight %></p>
79 + <p><%= userlist[i].userWeight %></p>
80 + </div>
81 + </div>
82 + </a>
83 + </div>
84 + <% }} %>
85 +
86 + </div>
87 + </div>
88 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
89 + </body>
90 +</html>
1 +<!DOCTYPE html>
2 +<html>
3 + <head>
4 + <meta charset="UTF-8" />
5 + <title>Setup</title>
6 + <link
7 + href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
8 + rel="stylesheet"
9 + />
10 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
11 + <!-- Font Awesome icons (free version)-->
12 + <script
13 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
14 + crossorigin="anonymous"
15 + ></script>
16 + <!-- Simple line icons-->
17 + <link
18 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
19 + rel="stylesheet"
20 + />
21 + <!-- Google fonts-->
22 + <link
23 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
24 + rel="stylesheet"
25 + type="text/css"
26 + />
27 + <link rel="preconnect" href="https://fonts.googleapis.com" />
28 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
29 + <link
30 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Jua&family=Anton&family=Fuzzy+Bubbles:wght@700&display=swap"
31 + rel="stylesheet"
32 + />
33 + <link rel="stylesheet" href="/stylesheets/styles.css" />
34 + <style>
35 + .title-fontA {
36 + font-family: "Fuzzy Bubbles", cursive;
37 + }
38 + .title-fontB {
39 + font-family: "Anton", sans-serif;
40 + }
41 + .day-fontB {
42 + font-family: "Jua", sans-serif;
43 + }
44 + </style>
45 + <script src="/static/examples.js"></script>
46 + </head>
47 +
48 + <body id="page-top">
49 + <div class="navbar navbar-expand-lg navbar-light bgtop">
50 + <div class="container text-center mx-4 my-1">
51 + <a class="navbar-brand title-fontA" href="/daySelect"
52 + >Health Assistant</a
53 + >
54 + </div>
55 + <div class="mx-3">
56 + <a class="otherUser title-fontB" href="/otherUser">OTHER</a>
57 + </div>
58 + <div class="mx-3">
59 + <a class="otherUser title-fontB" href="/myHealth">MY</a>
60 + </div>
61 + <div class="mx-3">
62 + <a class="otherUser title-fontB" href="/auth/logout/kakao">LOGOUT</a>
63 + </div>
64 + </div>
65 + <section class="container">
66 + <div>
67 + <h1 class="mt-5 text-center day-fontB">운동 추가!</h1>
68 + </div>
69 + <div class="mt-5" style="float: none; margin: 100 auto">
70 + <form
71 + class="w-50"
72 + style="float: none; margin: 0 auto"
73 + method="POST"
74 + action="/setup"
75 + >
76 + <div class="mb-3 row">
77 + <label for="staticEmail" class="col-sm-2 col-form-label"
78 + >요일</label
79 + >
80 + <div class="col-sm-10">
81 + <select class="form-select" name="day">
82 + <option>선택해주세요</option>
83 + <option value="월"></option>
84 + <option value="화"></option>
85 + <option value="수"></option>
86 + <option value="목"></option>
87 + <option value="금"></option>
88 + <option value="토"></option>
89 + <option value="일"></option>
90 + </select>
91 + </div>
92 + </div>
93 +
94 + <div class="mb-4 row">
95 + <label for="staticEmail" class="col-sm-2 col-form-label">
96 + 운동 부위
97 + </label>
98 + <div class="col-sm-10">
99 + <select
100 + class="form-select"
101 + name="part"
102 + id="part"
103 + onchange="addressKindChange(this)"
104 + >
105 + <option>선택해주세요</option>
106 + <option value="어깨">어깨</option>
107 + <option value="하체">하체</option>
108 + <option value="이삼두">이두 삼두</option>
109 + <option value="코어">코어</option>
110 + <option value="유산소">유산소</option>
111 + <option value="등"></option>
112 + <option value="가슴">가슴</option>
113 + <!-- <option value="d">이두</option> -->
114 + <!-- <option value="e">삼두</option>
115 + <option value="f">하체</option>
116 + <option value="g">코어</option> -->
117 + </select>
118 + </div>
119 + </div>
120 + <div class="mb-4 row">
121 + <label for="staticEmail" class="col-sm-2 col-form-label">
122 + 운동 방법
123 + </label>
124 + <div class="col-sm-10">
125 + <select class="form-select" id="way" name="way">
126 + <option>선택해주세요</option>
127 + </select>
128 + </div>
129 + </div>
130 + <div class="mb-4 row">
131 + <label for="staticEmail" class="col-sm-2 col-form-label">
132 + 세트 수
133 + </label>
134 + <div class="col-sm-10">
135 + <input class="form-control" type="text" name="setNumber" />
136 + </div>
137 + </div>
138 + <div class="mb-4 row">
139 + <label for="staticEmail" class="col-sm-2 col-form-label">
140 + 횟수
141 + </label>
142 + <div class="col-sm-10">
143 + <input class="form-control" type="text" name="number" />
144 + </div>
145 + </div>
146 + <div class="mb-4 row">
147 + <label for="staticEmail" class="col-sm-2 col-form-label">
148 + 쉬는 시간(초)
149 + </label>
150 + <div class="col-sm-10">
151 + <input class="form-control" type="text" name="breakTime" />
152 + </div>
153 + </div>
154 + <div class="mt-3 text-center">
155 + <button type="submit" class="btn btn-lg">
156 + <i class="fas fa-save"></i>
157 + </button>
158 + </div>
159 + </form>
160 + </div>
161 + </section>
162 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
163 + <script src="/static/scripts.js"></script>
164 + </body>
165 +</html>
This diff is collapsed. Click to expand it.
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="utf-8" />
5 + <meta
6 + name="viewport"
7 + content="width=device-width, initial-scale=1, shrink-to-fit=no"
8 + />
9 + <meta name="description" content="" />
10 + <meta name="author" content="" />
11 + <title>정보 입력</title>
12 + <!-- Favicon-->
13 + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
14 + <!-- Font Awesome icons (free version)-->
15 + <script
16 + src="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
17 + crossorigin="anonymous"
18 + ></script>
19 + <!-- Simple line icons-->
20 + <link
21 + href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css"
22 + rel="stylesheet"
23 + />
24 + <!-- Google fonts-->
25 + <link
26 + href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic"
27 + rel="stylesheet"
28 + type="text/css"
29 + />
30 + <!-- Core theme CSS (includes Bootstrap)-->
31 + <link rel="preconnect" href="https://fonts.googleapis.com" />
32 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
33 + <link
34 + href="https://fonts.googleapis.com/css2?family=Corinthia:wght@700&family=Fuzzy+Bubbles:wght@700&display=swap"
35 + rel="stylesheet"
36 + />
37 + <link rel="stylesheet" href="/stylesheets/styles.css" />
38 + <style>
39 + .title-fontA {
40 + font-family: "Fuzzy Bubbles", cursive;
41 + }
42 + </style>
43 + </head>
44 + <body id="page-top">
45 + <div class="navbar navbar-expand-lg navbar-light fixed-top">
46 + <div class="container mx-4 my-1">
47 + <a class="navbar-brand title-fontA">Health Assistant</a>
48 + </div>
49 + </div>
50 + <div class="mastheadSecond">
51 + <div class="container text-center mt-5">
52 + <h1 class="text-white">User Information</h1>
53 + <div class="row">
54 + <div class="col-lg-6 order-lg-1">
55 + <div class="p-5 mr-2 float-end">
56 + <img
57 + class="img-fluid rounded-circle"
58 + src="../stylesheets/assets/img/human.png"
59 + alt="..."
60 + />
61 + </div>
62 + </div>
63 + <div class="col-lg-6 order-lg-2">
64 + <div class="p-5 mt-3">
65 + <form action="/user" method="post" id="userForm">
66 + <div class="mt-5">
67 + <input
68 + class="form-control w-50 text-center"
69 + placeholder="키를 입력해주세요"
70 + type="text"
71 + name="height"
72 + />
73 + </div>
74 + <div class="mt-4">
75 + <input
76 + class="form-control w-50 text-center"
77 + placeholder="몸무게를 입력해주세요"
78 + type="text"
79 + name="weight"
80 + />
81 + </div>
82 + <div>
83 + <button
84 + class="btn btn-primary rounded float-start w-50 mt-4"
85 + type="submit"
86 + >
87 + 확인
88 + </button>
89 + </div>
90 + </form>
91 + </div>
92 + </div>
93 + </div>
94 + </div>
95 + </div>
96 + <!-- Bootstrap core JS-->
97 + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
98 + <!-- Core theme JS-->
99 + <script src="/static/scripts.js"></script>
100 + </body>
101 +</html>