<file_sep>

var http = require('http'); // 서버 구동을 위한 node 내장 모듈 불러옴
var fs = require('fs'); //파일 읽기, 쓰기를 위한 node 내장 모듈 불러옴

// 404 error message : 페이지 오류가 발생 하였을때
function send404Message(response){
  response.writeHead(404,{"Content-Type":"text/plain"}); //단순한 글자 출력
  response.write("404 에러...");
  response.end();
}

// 200 okay: 정상적인 요청일때

function onRequest(request,response){

  if (request.method == 'GET' && request.url == '/'){
    response.writeHead(200,{"Content-Type":"text/html"});//웹페이지 출력
    fs.createReadStream("./momentumTodo.html").pipe(response); //html 웹페이지 respond
  }else{
    //html 파일이 존재하지 않을시에는
    send404Message(response);
  }
}

http.createServer(onRequest).listen(8080); //포트번호 8888
console.log("Server Created!!");<file_sep>var _global = {}
// doc ready
$(document).ready(function(){
	getLocation();
});<file_sep>'use strict';
let clock = document.getElementById("clock");
let userName = document.getElementById("userName");
let yourName = document.getElementById("yourName");
let welcome = document.getElementById("welcome");
let wiseQuotes = document.getElementById("wiseQuotes");
let userInputName = "";


function imgChange () {
    let imgSrc = `images/backGround${Math.floor(Math.random()*3)}.jpg`
    document.body.style.backgroundImage = `url(${imgSrc})`;
}


function clockGen() {
    const d = new Date();
    let hours = d.getHours();
    let minutes = d.getMinutes();
    let seconds = d.getSeconds();
    seconds = seconds < 10 ? `0${seconds}` : seconds;
    minutes = minutes < 10 ? `0${minutes}` : minutes;
    hours = hours < 10 ? `0${hours}` : hours;
    clock.innerHTML = `${hours}:${minutes}:${seconds}`;
};

function enterkey() {
    if (window.event.keyCode == 13) {
        userInputName = userName.value;
        yourName.classList.add('disappear');
        if(yourName.style.opacity = 0 || true) {
            yourName.innerHTML = `Good afternoon ${userInputName}`;
            yourName.classList = 'appear';
        };
    }
}

let quotesArr = ["Life is not a problem to be solved, but a reality to be experienced.",
                "Life is ten percent what happens to you and ninety percent how you respond to it.",
                "Believe that life is worth living and your belief will help create the fact.",
                "The only disability in life is a bad attitude."
                ];
let quoteCnt = 0;

function incrementIndex() {
    if (quoteCnt < quotesArr.length - 1) {
        quoteCnt++;
    }
    else {
        quoteCnt = 0;
    }
};

function quotesGen() {
    incrementIndex();
    wiseQuotes.classList = 'disappear';
    setTimeout(appearQuotes, 5000);
};

function appearQuotes() {
    wiseQuotes.classList = 'appear';
    wiseQuotes.innerHTML = quotesArr[quoteCnt];
}


function init() {
    imgChange ();
    setInterval(clockGen, 100);
    setInterval(quotesGen , 9000)
};

init();



<file_sep>//index.js

var express = require("express");
var app = express();
var path = require('path');


app.listen(3000, function(){
    console.log("App is running on port 3000");
});

app.use(express.static(path.join(__dirname, 'resouces/css')));
app.use(express.static(path.join(__dirname, 'resouces/js')));
app.get("/", function(req, res){
    res.sendfile("momentumTodo.html");
});<file_sep># our-fisrt-project---momentum-clone


24/09/20 oy
$ node app.js  -- 실행 시 localhost:3000 으로 웹어플리케이션 deploy 가능
added - node 라이브러리 express 추가


24/09/20
momentum html, css 가이드라인 제작
권준호 할 것 : geolocation, todolistControl 정주형 할 것 : clock, backgroundImage, weatherApi


23/09/20
moment 클론 하기로 결정
nodes.js github 생활코딩 강의 시작

