Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jeongmin Seo
/
favorite_restaurant
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jumi Yang
2022-06-05 22:41:23 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
46edde80a76ce532724169b227f4709265e57527
46edde80
1 parent
67f92772
Update chatting feature
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1228 additions
and
35 deletions
chat/app.js → chat/app/app.js
chat/app/package-lock.json
chat/package.json → chat/app/package.json
chat/app/src/css/style.css
chat/app/src/index.html
chat/app/src/js/chat.js
chat/app.js
→
chat/app
/app
.js
View file @
46edde8
...
...
@@ -4,6 +4,8 @@ const app = express();
const
path
=
require
(
"path"
)
const
server
=
http
.
createServer
(
app
);
const
socketIO
=
require
(
"socket.io"
)
const
moment
=
require
(
"moment"
)
const
io
=
socketIO
(
server
);
...
...
@@ -12,7 +14,12 @@ const PORT = process.env.PORT || 3000;
io
.
on
(
'connection'
,
(
socket
)
=>
{
socket
.
on
(
"chatting"
,
(
data
)
=>
{
io
.
emit
(
"chatting"
,
data
)
const
{
name
,
msg
}
=
data
;
io
.
emit
(
"chatting"
,
{
name
,
msg
,
time
:
moment
.
format
(
"h:ss A"
)
})
})
});
...
...
chat/app/package-lock.json
0 → 100644
View file @
46edde8
{
"name"
:
"chat"
,
"version"
:
"1.0.0"
,
"lockfileVersion"
:
2
,
"requires"
:
true
,
"packages"
:
{
""
:
{
"name"
:
"chat"
,
"version"
:
"1.0.0"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"dayjs"
:
"^1.11.2"
,
"express"
:
"^4.18.1"
,
"moment"
:
"^2.29.3"
,
"socket.io"
:
"^4.5.1"
}
},
"node_modules/@types/component-emitter"
:
{
"version"
:
"1.2.11"
,
"license"
:
"MIT"
},
"node_modules/@types/cookie"
:
{
"version"
:
"0.4.1"
,
"license"
:
"MIT"
},
"node_modules/@types/cors"
:
{
"version"
:
"2.8.12"
,
"license"
:
"MIT"
},
"node_modules/@types/node"
:
{
"version"
:
"17.0.39"
,
"license"
:
"MIT"
},
"node_modules/accepts"
:
{
"version"
:
"1.3.8"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"mime-types"
:
"~2.1.34"
,
"negotiator"
:
"0.6.3"
},
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/array-flatten"
:
{
"version"
:
"1.1.1"
,
"license"
:
"MIT"
},
"node_modules/base64id"
:
{
"version"
:
"2.0.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
"^4.5.0 || >= 5.9"
}
},
"node_modules/body-parser"
:
{
"version"
:
"1.20.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"bytes"
:
"3.1.2"
,
"content-type"
:
"~1.0.4"
,
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"destroy"
:
"1.2.0"
,
"http-errors"
:
"2.0.0"
,
"iconv-lite"
:
"0.4.24"
,
"on-finished"
:
"2.4.1"
,
"qs"
:
"6.10.3"
,
"raw-body"
:
"2.5.1"
,
"type-is"
:
"~1.6.18"
,
"unpipe"
:
"1.0.0"
},
"engines"
:
{
"node"
:
">= 0.8"
,
"npm"
:
"1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes"
:
{
"version"
:
"3.1.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/call-bind"
:
{
"version"
:
"1.0.2"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"function-bind"
:
"^1.1.1"
,
"get-intrinsic"
:
"^1.0.2"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/component-emitter"
:
{
"version"
:
"1.3.0"
,
"license"
:
"MIT"
},
"node_modules/content-disposition"
:
{
"version"
:
"0.5.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"safe-buffer"
:
"5.2.1"
},
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/content-type"
:
{
"version"
:
"1.0.4"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/cookie"
:
{
"version"
:
"0.5.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/cookie-signature"
:
{
"version"
:
"1.0.6"
,
"license"
:
"MIT"
},
"node_modules/cors"
:
{
"version"
:
"2.8.5"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"object-assign"
:
"^4"
,
"vary"
:
"^1"
},
"engines"
:
{
"node"
:
">= 0.10"
}
},
"node_modules/dayjs"
:
{
"version"
:
"1.11.2"
,
"resolved"
:
"https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz"
,
"integrity"
:
"sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
},
"node_modules/debug"
:
{
"version"
:
"2.6.9"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"ms"
:
"2.0.0"
}
},
"node_modules/depd"
:
{
"version"
:
"2.0.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/destroy"
:
{
"version"
:
"1.2.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
,
"npm"
:
"1.2.8000 || >= 1.4.16"
}
},
"node_modules/ee-first"
:
{
"version"
:
"1.1.1"
,
"license"
:
"MIT"
},
"node_modules/encodeurl"
:
{
"version"
:
"1.0.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/engine.io"
:
{
"version"
:
"6.2.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"@types/cookie"
:
"^0.4.1"
,
"@types/cors"
:
"^2.8.12"
,
"@types/node"
:
">=10.0.0"
,
"accepts"
:
"~1.3.4"
,
"base64id"
:
"2.0.0"
,
"cookie"
:
"~0.4.1"
,
"cors"
:
"~2.8.5"
,
"debug"
:
"~4.3.1"
,
"engine.io-parser"
:
"~5.0.3"
,
"ws"
:
"~8.2.3"
},
"engines"
:
{
"node"
:
">=10.0.0"
}
},
"node_modules/engine.io-parser"
:
{
"version"
:
"5.0.4"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=10.0.0"
}
},
"node_modules/engine.io/node_modules/cookie"
:
{
"version"
:
"0.4.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/engine.io/node_modules/debug"
:
{
"version"
:
"4.3.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"ms"
:
"2.1.2"
},
"engines"
:
{
"node"
:
">=6.0"
},
"peerDependenciesMeta"
:
{
"supports-color"
:
{
"optional"
:
true
}
}
},
"node_modules/engine.io/node_modules/ms"
:
{
"version"
:
"2.1.2"
,
"license"
:
"MIT"
},
"node_modules/escape-html"
:
{
"version"
:
"1.0.3"
,
"license"
:
"MIT"
},
"node_modules/etag"
:
{
"version"
:
"1.8.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/express"
:
{
"version"
:
"4.18.1"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"accepts"
:
"~1.3.8"
,
"array-flatten"
:
"1.1.1"
,
"body-parser"
:
"1.20.0"
,
"content-disposition"
:
"0.5.4"
,
"content-type"
:
"~1.0.4"
,
"cookie"
:
"0.5.0"
,
"cookie-signature"
:
"1.0.6"
,
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"etag"
:
"~1.8.1"
,
"finalhandler"
:
"1.2.0"
,
"fresh"
:
"0.5.2"
,
"http-errors"
:
"2.0.0"
,
"merge-descriptors"
:
"1.0.1"
,
"methods"
:
"~1.1.2"
,
"on-finished"
:
"2.4.1"
,
"parseurl"
:
"~1.3.3"
,
"path-to-regexp"
:
"0.1.7"
,
"proxy-addr"
:
"~2.0.7"
,
"qs"
:
"6.10.3"
,
"range-parser"
:
"~1.2.1"
,
"safe-buffer"
:
"5.2.1"
,
"send"
:
"0.18.0"
,
"serve-static"
:
"1.15.0"
,
"setprototypeof"
:
"1.2.0"
,
"statuses"
:
"2.0.1"
,
"type-is"
:
"~1.6.18"
,
"utils-merge"
:
"1.0.1"
,
"vary"
:
"~1.1.2"
},
"engines"
:
{
"node"
:
">= 0.10.0"
}
},
"node_modules/finalhandler"
:
{
"version"
:
"1.2.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"debug"
:
"2.6.9"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"on-finished"
:
"2.4.1"
,
"parseurl"
:
"~1.3.3"
,
"statuses"
:
"2.0.1"
,
"unpipe"
:
"~1.0.0"
},
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/forwarded"
:
{
"version"
:
"0.2.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/fresh"
:
{
"version"
:
"0.5.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/function-bind"
:
{
"version"
:
"1.1.1"
,
"license"
:
"MIT"
},
"node_modules/get-intrinsic"
:
{
"version"
:
"1.1.1"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"function-bind"
:
"^1.1.1"
,
"has"
:
"^1.0.3"
,
"has-symbols"
:
"^1.0.1"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/has"
:
{
"version"
:
"1.0.3"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"function-bind"
:
"^1.1.1"
},
"engines"
:
{
"node"
:
">= 0.4.0"
}
},
"node_modules/has-symbols"
:
{
"version"
:
"1.0.3"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.4"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/http-errors"
:
{
"version"
:
"2.0.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"depd"
:
"2.0.0"
,
"inherits"
:
"2.0.4"
,
"setprototypeof"
:
"1.2.0"
,
"statuses"
:
"2.0.1"
,
"toidentifier"
:
"1.0.1"
},
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/iconv-lite"
:
{
"version"
:
"0.4.24"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"safer-buffer"
:
">= 2.1.2 < 3"
},
"engines"
:
{
"node"
:
">=0.10.0"
}
},
"node_modules/inherits"
:
{
"version"
:
"2.0.4"
,
"license"
:
"ISC"
},
"node_modules/ipaddr.js"
:
{
"version"
:
"1.9.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.10"
}
},
"node_modules/media-typer"
:
{
"version"
:
"0.3.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/merge-descriptors"
:
{
"version"
:
"1.0.1"
,
"license"
:
"MIT"
},
"node_modules/methods"
:
{
"version"
:
"1.1.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/mime"
:
{
"version"
:
"1.6.0"
,
"license"
:
"MIT"
,
"bin"
:
{
"mime"
:
"cli.js"
},
"engines"
:
{
"node"
:
">=4"
}
},
"node_modules/mime-db"
:
{
"version"
:
"1.52.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/mime-types"
:
{
"version"
:
"2.1.35"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"mime-db"
:
"1.52.0"
},
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/moment"
:
{
"version"
:
"2.29.3"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
"*"
}
},
"node_modules/ms"
:
{
"version"
:
"2.0.0"
,
"license"
:
"MIT"
},
"node_modules/negotiator"
:
{
"version"
:
"0.6.3"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/object-assign"
:
{
"version"
:
"4.1.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=0.10.0"
}
},
"node_modules/object-inspect"
:
{
"version"
:
"1.12.2"
,
"license"
:
"MIT"
,
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished"
:
{
"version"
:
"2.4.1"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"ee-first"
:
"1.1.1"
},
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/parseurl"
:
{
"version"
:
"1.3.3"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/path-to-regexp"
:
{
"version"
:
"0.1.7"
,
"license"
:
"MIT"
},
"node_modules/proxy-addr"
:
{
"version"
:
"2.0.7"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"forwarded"
:
"0.2.0"
,
"ipaddr.js"
:
"1.9.1"
},
"engines"
:
{
"node"
:
">= 0.10"
}
},
"node_modules/qs"
:
{
"version"
:
"6.10.3"
,
"license"
:
"BSD-3-Clause"
,
"dependencies"
:
{
"side-channel"
:
"^1.0.4"
},
"engines"
:
{
"node"
:
">=0.6"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser"
:
{
"version"
:
"1.2.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/raw-body"
:
{
"version"
:
"2.5.1"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"bytes"
:
"3.1.2"
,
"http-errors"
:
"2.0.0"
,
"iconv-lite"
:
"0.4.24"
,
"unpipe"
:
"1.0.0"
},
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/safe-buffer"
:
{
"version"
:
"5.2.1"
,
"funding"
:
[
{
"type"
:
"github"
,
"url"
:
"https://github.com/sponsors/feross"
},
{
"type"
:
"patreon"
,
"url"
:
"https://www.patreon.com/feross"
},
{
"type"
:
"consulting"
,
"url"
:
"https://feross.org/support"
}
],
"license"
:
"MIT"
},
"node_modules/safer-buffer"
:
{
"version"
:
"2.1.2"
,
"license"
:
"MIT"
},
"node_modules/send"
:
{
"version"
:
"0.18.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"destroy"
:
"1.2.0"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"etag"
:
"~1.8.1"
,
"fresh"
:
"0.5.2"
,
"http-errors"
:
"2.0.0"
,
"mime"
:
"1.6.0"
,
"ms"
:
"2.1.3"
,
"on-finished"
:
"2.4.1"
,
"range-parser"
:
"~1.2.1"
,
"statuses"
:
"2.0.1"
},
"engines"
:
{
"node"
:
">= 0.8.0"
}
},
"node_modules/send/node_modules/ms"
:
{
"version"
:
"2.1.3"
,
"license"
:
"MIT"
},
"node_modules/serve-static"
:
{
"version"
:
"1.15.0"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"parseurl"
:
"~1.3.3"
,
"send"
:
"0.18.0"
},
"engines"
:
{
"node"
:
">= 0.8.0"
}
},
"node_modules/setprototypeof"
:
{
"version"
:
"1.2.0"
,
"license"
:
"ISC"
},
"node_modules/side-channel"
:
{
"version"
:
"1.0.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"call-bind"
:
"^1.0.0"
,
"get-intrinsic"
:
"^1.0.2"
,
"object-inspect"
:
"^1.9.0"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/ljharb"
}
},
"node_modules/socket.io"
:
{
"version"
:
"4.5.1"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"accepts"
:
"~1.3.4"
,
"base64id"
:
"~2.0.0"
,
"debug"
:
"~4.3.2"
,
"engine.io"
:
"~6.2.0"
,
"socket.io-adapter"
:
"~2.4.0"
,
"socket.io-parser"
:
"~4.0.4"
},
"engines"
:
{
"node"
:
">=10.0.0"
}
},
"node_modules/socket.io-adapter"
:
{
"version"
:
"2.4.0"
,
"license"
:
"MIT"
},
"node_modules/socket.io-parser"
:
{
"version"
:
"4.0.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"@types/component-emitter"
:
"^1.2.10"
,
"component-emitter"
:
"~1.3.0"
,
"debug"
:
"~4.3.1"
},
"engines"
:
{
"node"
:
">=10.0.0"
}
},
"node_modules/socket.io-parser/node_modules/debug"
:
{
"version"
:
"4.3.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"ms"
:
"2.1.2"
},
"engines"
:
{
"node"
:
">=6.0"
},
"peerDependenciesMeta"
:
{
"supports-color"
:
{
"optional"
:
true
}
}
},
"node_modules/socket.io-parser/node_modules/ms"
:
{
"version"
:
"2.1.2"
,
"license"
:
"MIT"
},
"node_modules/socket.io/node_modules/debug"
:
{
"version"
:
"4.3.4"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"ms"
:
"2.1.2"
},
"engines"
:
{
"node"
:
">=6.0"
},
"peerDependenciesMeta"
:
{
"supports-color"
:
{
"optional"
:
true
}
}
},
"node_modules/socket.io/node_modules/ms"
:
{
"version"
:
"2.1.2"
,
"license"
:
"MIT"
},
"node_modules/statuses"
:
{
"version"
:
"2.0.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/toidentifier"
:
{
"version"
:
"1.0.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=0.6"
}
},
"node_modules/type-is"
:
{
"version"
:
"1.6.18"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"media-typer"
:
"0.3.0"
,
"mime-types"
:
"~2.1.24"
},
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/unpipe"
:
{
"version"
:
"1.0.0"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/utils-merge"
:
{
"version"
:
"1.0.1"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.4.0"
}
},
"node_modules/vary"
:
{
"version"
:
"1.1.2"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">= 0.8"
}
},
"node_modules/ws"
:
{
"version"
:
"8.2.3"
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=10.0.0"
},
"peerDependencies"
:
{
"bufferutil"
:
"^4.0.1"
,
"utf-8-validate"
:
"^5.0.2"
},
"peerDependenciesMeta"
:
{
"bufferutil"
:
{
"optional"
:
true
},
"utf-8-validate"
:
{
"optional"
:
true
}
}
}
},
"dependencies"
:
{
"@types/component-emitter"
:
{
"version"
:
"1.2.11"
},
"@types/cookie"
:
{
"version"
:
"0.4.1"
},
"@types/cors"
:
{
"version"
:
"2.8.12"
},
"@types/node"
:
{
"version"
:
"17.0.39"
},
"accepts"
:
{
"version"
:
"1.3.8"
,
"requires"
:
{
"mime-types"
:
"~2.1.34"
,
"negotiator"
:
"0.6.3"
}
},
"array-flatten"
:
{
"version"
:
"1.1.1"
},
"base64id"
:
{
"version"
:
"2.0.0"
},
"body-parser"
:
{
"version"
:
"1.20.0"
,
"requires"
:
{
"bytes"
:
"3.1.2"
,
"content-type"
:
"~1.0.4"
,
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"destroy"
:
"1.2.0"
,
"http-errors"
:
"2.0.0"
,
"iconv-lite"
:
"0.4.24"
,
"on-finished"
:
"2.4.1"
,
"qs"
:
"6.10.3"
,
"raw-body"
:
"2.5.1"
,
"type-is"
:
"~1.6.18"
,
"unpipe"
:
"1.0.0"
}
},
"bytes"
:
{
"version"
:
"3.1.2"
},
"call-bind"
:
{
"version"
:
"1.0.2"
,
"requires"
:
{
"function-bind"
:
"^1.1.1"
,
"get-intrinsic"
:
"^1.0.2"
}
},
"component-emitter"
:
{
"version"
:
"1.3.0"
},
"content-disposition"
:
{
"version"
:
"0.5.4"
,
"requires"
:
{
"safe-buffer"
:
"5.2.1"
}
},
"content-type"
:
{
"version"
:
"1.0.4"
},
"cookie"
:
{
"version"
:
"0.5.0"
},
"cookie-signature"
:
{
"version"
:
"1.0.6"
},
"cors"
:
{
"version"
:
"2.8.5"
,
"requires"
:
{
"object-assign"
:
"^4"
,
"vary"
:
"^1"
}
},
"dayjs"
:
{
"version"
:
"1.11.2"
,
"resolved"
:
"https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz"
,
"integrity"
:
"sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
},
"debug"
:
{
"version"
:
"2.6.9"
,
"requires"
:
{
"ms"
:
"2.0.0"
}
},
"depd"
:
{
"version"
:
"2.0.0"
},
"destroy"
:
{
"version"
:
"1.2.0"
},
"ee-first"
:
{
"version"
:
"1.1.1"
},
"encodeurl"
:
{
"version"
:
"1.0.2"
},
"engine.io"
:
{
"version"
:
"6.2.0"
,
"requires"
:
{
"@types/cookie"
:
"^0.4.1"
,
"@types/cors"
:
"^2.8.12"
,
"@types/node"
:
">=10.0.0"
,
"accepts"
:
"~1.3.4"
,
"base64id"
:
"2.0.0"
,
"cookie"
:
"~0.4.1"
,
"cors"
:
"~2.8.5"
,
"debug"
:
"~4.3.1"
,
"engine.io-parser"
:
"~5.0.3"
,
"ws"
:
"~8.2.3"
},
"dependencies"
:
{
"cookie"
:
{
"version"
:
"0.4.2"
},
"debug"
:
{
"version"
:
"4.3.4"
,
"requires"
:
{
"ms"
:
"2.1.2"
}
},
"ms"
:
{
"version"
:
"2.1.2"
}
}
},
"engine.io-parser"
:
{
"version"
:
"5.0.4"
},
"escape-html"
:
{
"version"
:
"1.0.3"
},
"etag"
:
{
"version"
:
"1.8.1"
},
"express"
:
{
"version"
:
"4.18.1"
,
"requires"
:
{
"accepts"
:
"~1.3.8"
,
"array-flatten"
:
"1.1.1"
,
"body-parser"
:
"1.20.0"
,
"content-disposition"
:
"0.5.4"
,
"content-type"
:
"~1.0.4"
,
"cookie"
:
"0.5.0"
,
"cookie-signature"
:
"1.0.6"
,
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"etag"
:
"~1.8.1"
,
"finalhandler"
:
"1.2.0"
,
"fresh"
:
"0.5.2"
,
"http-errors"
:
"2.0.0"
,
"merge-descriptors"
:
"1.0.1"
,
"methods"
:
"~1.1.2"
,
"on-finished"
:
"2.4.1"
,
"parseurl"
:
"~1.3.3"
,
"path-to-regexp"
:
"0.1.7"
,
"proxy-addr"
:
"~2.0.7"
,
"qs"
:
"6.10.3"
,
"range-parser"
:
"~1.2.1"
,
"safe-buffer"
:
"5.2.1"
,
"send"
:
"0.18.0"
,
"serve-static"
:
"1.15.0"
,
"setprototypeof"
:
"1.2.0"
,
"statuses"
:
"2.0.1"
,
"type-is"
:
"~1.6.18"
,
"utils-merge"
:
"1.0.1"
,
"vary"
:
"~1.1.2"
}
},
"finalhandler"
:
{
"version"
:
"1.2.0"
,
"requires"
:
{
"debug"
:
"2.6.9"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"on-finished"
:
"2.4.1"
,
"parseurl"
:
"~1.3.3"
,
"statuses"
:
"2.0.1"
,
"unpipe"
:
"~1.0.0"
}
},
"forwarded"
:
{
"version"
:
"0.2.0"
},
"fresh"
:
{
"version"
:
"0.5.2"
},
"function-bind"
:
{
"version"
:
"1.1.1"
},
"get-intrinsic"
:
{
"version"
:
"1.1.1"
,
"requires"
:
{
"function-bind"
:
"^1.1.1"
,
"has"
:
"^1.0.3"
,
"has-symbols"
:
"^1.0.1"
}
},
"has"
:
{
"version"
:
"1.0.3"
,
"requires"
:
{
"function-bind"
:
"^1.1.1"
}
},
"has-symbols"
:
{
"version"
:
"1.0.3"
},
"http-errors"
:
{
"version"
:
"2.0.0"
,
"requires"
:
{
"depd"
:
"2.0.0"
,
"inherits"
:
"2.0.4"
,
"setprototypeof"
:
"1.2.0"
,
"statuses"
:
"2.0.1"
,
"toidentifier"
:
"1.0.1"
}
},
"iconv-lite"
:
{
"version"
:
"0.4.24"
,
"requires"
:
{
"safer-buffer"
:
">= 2.1.2 < 3"
}
},
"inherits"
:
{
"version"
:
"2.0.4"
},
"ipaddr.js"
:
{
"version"
:
"1.9.1"
},
"media-typer"
:
{
"version"
:
"0.3.0"
},
"merge-descriptors"
:
{
"version"
:
"1.0.1"
},
"methods"
:
{
"version"
:
"1.1.2"
},
"mime"
:
{
"version"
:
"1.6.0"
},
"mime-db"
:
{
"version"
:
"1.52.0"
},
"mime-types"
:
{
"version"
:
"2.1.35"
,
"requires"
:
{
"mime-db"
:
"1.52.0"
}
},
"moment"
:
{
"version"
:
"2.29.3"
},
"ms"
:
{
"version"
:
"2.0.0"
},
"negotiator"
:
{
"version"
:
"0.6.3"
},
"object-assign"
:
{
"version"
:
"4.1.1"
},
"object-inspect"
:
{
"version"
:
"1.12.2"
},
"on-finished"
:
{
"version"
:
"2.4.1"
,
"requires"
:
{
"ee-first"
:
"1.1.1"
}
},
"parseurl"
:
{
"version"
:
"1.3.3"
},
"path-to-regexp"
:
{
"version"
:
"0.1.7"
},
"proxy-addr"
:
{
"version"
:
"2.0.7"
,
"requires"
:
{
"forwarded"
:
"0.2.0"
,
"ipaddr.js"
:
"1.9.1"
}
},
"qs"
:
{
"version"
:
"6.10.3"
,
"requires"
:
{
"side-channel"
:
"^1.0.4"
}
},
"range-parser"
:
{
"version"
:
"1.2.1"
},
"raw-body"
:
{
"version"
:
"2.5.1"
,
"requires"
:
{
"bytes"
:
"3.1.2"
,
"http-errors"
:
"2.0.0"
,
"iconv-lite"
:
"0.4.24"
,
"unpipe"
:
"1.0.0"
}
},
"safe-buffer"
:
{
"version"
:
"5.2.1"
},
"safer-buffer"
:
{
"version"
:
"2.1.2"
},
"send"
:
{
"version"
:
"0.18.0"
,
"requires"
:
{
"debug"
:
"2.6.9"
,
"depd"
:
"2.0.0"
,
"destroy"
:
"1.2.0"
,
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"etag"
:
"~1.8.1"
,
"fresh"
:
"0.5.2"
,
"http-errors"
:
"2.0.0"
,
"mime"
:
"1.6.0"
,
"ms"
:
"2.1.3"
,
"on-finished"
:
"2.4.1"
,
"range-parser"
:
"~1.2.1"
,
"statuses"
:
"2.0.1"
},
"dependencies"
:
{
"ms"
:
{
"version"
:
"2.1.3"
}
}
},
"serve-static"
:
{
"version"
:
"1.15.0"
,
"requires"
:
{
"encodeurl"
:
"~1.0.2"
,
"escape-html"
:
"~1.0.3"
,
"parseurl"
:
"~1.3.3"
,
"send"
:
"0.18.0"
}
},
"setprototypeof"
:
{
"version"
:
"1.2.0"
},
"side-channel"
:
{
"version"
:
"1.0.4"
,
"requires"
:
{
"call-bind"
:
"^1.0.0"
,
"get-intrinsic"
:
"^1.0.2"
,
"object-inspect"
:
"^1.9.0"
}
},
"socket.io"
:
{
"version"
:
"4.5.1"
,
"requires"
:
{
"accepts"
:
"~1.3.4"
,
"base64id"
:
"~2.0.0"
,
"debug"
:
"~4.3.2"
,
"engine.io"
:
"~6.2.0"
,
"socket.io-adapter"
:
"~2.4.0"
,
"socket.io-parser"
:
"~4.0.4"
},
"dependencies"
:
{
"debug"
:
{
"version"
:
"4.3.4"
,
"requires"
:
{
"ms"
:
"2.1.2"
}
},
"ms"
:
{
"version"
:
"2.1.2"
}
}
},
"socket.io-adapter"
:
{
"version"
:
"2.4.0"
},
"socket.io-parser"
:
{
"version"
:
"4.0.4"
,
"requires"
:
{
"@types/component-emitter"
:
"^1.2.10"
,
"component-emitter"
:
"~1.3.0"
,
"debug"
:
"~4.3.1"
},
"dependencies"
:
{
"debug"
:
{
"version"
:
"4.3.4"
,
"requires"
:
{
"ms"
:
"2.1.2"
}
},
"ms"
:
{
"version"
:
"2.1.2"
}
}
},
"statuses"
:
{
"version"
:
"2.0.1"
},
"toidentifier"
:
{
"version"
:
"1.0.1"
},
"type-is"
:
{
"version"
:
"1.6.18"
,
"requires"
:
{
"media-typer"
:
"0.3.0"
,
"mime-types"
:
"~2.1.24"
}
},
"unpipe"
:
{
"version"
:
"1.0.0"
},
"utils-merge"
:
{
"version"
:
"1.0.1"
},
"vary"
:
{
"version"
:
"1.1.2"
},
"ws"
:
{
"version"
:
"8.2.3"
,
"requires"
:
{}
}
}
}
chat/package.json
→
chat/
app/
package.json
View file @
46edde8
...
...
@@ -4,12 +4,14 @@
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"start"
:
"nodemon ./app.js"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"keywords"
:
[],
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"dayjs"
:
"^1.11.2"
,
"express"
:
"^4.18.1"
,
"moment"
:
"^2.29.3"
,
"socket.io"
:
"^4.5.1"
...
...
chat/app/src/css/style.css
View file @
46edde8
...
...
@@ -16,7 +16,7 @@ html, body {
}
.user-container
{
background
:
#a9bdc
e
;
background
:
rebeccapurpl
e
;
flex
:
1
;
display
:
flex
;
justify-content
:
flex-start
;
...
...
@@ -24,19 +24,21 @@ html, body {
padding
:
0.5rem
;
}
.user-container
label
{
.user-container
.nickname
{
font-size
:
14px
;
margin-right
:
1rem
;
margin-right
:
1.5rem
;
margin-left
:
1rem
;
color
:
#fff
;
}
.user-container
input
{
border-radius
:
3px
;
border
:
none
;
height
:
10
0%
;
height
:
8
0%
;
}
.display-container
{
background
:
#
b2c7d9
;
background
:
#
D2D2FF
;
flex
:
12
;
overflow-y
:
scroll
;
}
...
...
@@ -65,14 +67,15 @@ html, body {
.send-button
{
flex
:
1
;
background
:
#ffeb33
;
background
:
rebeccapurple
;
color
:
#fff
;
border
:
none
;
height
:
100%
;
border-radius
:
3px
;
}
.chatting-list
li
{
width
:
9
0%
;
width
:
5
0%
;
padding
:
0.3rem
;
display
:
flex
;
justify-content
:
flex-start
;
...
...
@@ -105,7 +108,7 @@ html, body {
padding
:
0.5rem
;
font-size
:
12px
;
margin
:
0
5px
;
flex
:
7
;
flex
:
10
;
}
.time
{
...
...
@@ -119,7 +122,8 @@ html, body {
}
.sent
.message
{
background
:
#ffeb33
;
background
:
#9986EE
;
color
:
#fff
;
}
.received
.message
{
...
...
chat/app/src/index.html
View file @
46edde8
...
...
@@ -10,27 +10,12 @@
<body>
<div
class=
"wrapper"
>
<div
class=
"user-container"
>
<lable
for=
"nickname"
>
대화명
</lable>
<lable
class=
"nickname"
for=
"nickname"
>
닉네임설정
</lable>
<input
type=
"text"
id=
"nickname"
>
</div>
<div
class=
"display-container"
>
<ul
class=
"chatting-list"
>
<li
class=
"sent"
>
<span
class=
"profile"
>
<span
class=
"user"
>
깔깔
</span>
<img
class=
"image"
src=
"https://placeimg.com/50/50/any"
alt=
"any"
>
</span>
<span
class=
"message"
>
그래 반가워
</span>
<span
class=
"time"
>
오후 2:10
</span>
</li>
<li
class=
"received"
>
<span
class=
"profile"
>
<span
class=
"user"
>
깔깔
</span>
<img
class=
"image"
src=
"https://placeimg.com/50/50/any"
alt=
"any"
>
</span>
<span
class=
"message"
>
그래 반가워
</span>
<span
class=
"time"
>
오후 2:10
</span>
</li>
</ul>
</div>
<div
class=
"input-container"
>
...
...
@@ -41,7 +26,7 @@
</div>
</div>
<
!-- <
script src="/socket.io/socket.io.js"></script>
<script src="js/chat.js"></script>
-->
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"js/chat.js"
></script>
</body>
</html>
\ No newline at end of file
...
...
chat/app/src/js/chat.js
View file @
46edde8
...
...
@@ -5,18 +5,50 @@ const nickname = document.querySelector("#nickname")
const
chatlist
=
document
.
querySelector
(
".chatting-list"
)
const
chatInput
=
document
.
querySelector
(
".chatting-input"
)
const
sendButton
=
document
.
querySelector
(
".send-button"
)
const
displayContainer
=
document
.
querySelector
(
".display-container"
)
sendButton
.
addEventListener
(
"click"
,
()
=>
{
chatInput
.
addEventListener
(
"keypress"
,
(
event
)
=>
{
if
(
event
.
keyCode
===
13
)
{
send
()
}
})
function
send
()
{
const
param
=
{
name
:
nickname
.
value
,
msg
:
chatInput
.
value
}
socket
.
emit
(
"chatting"
,
param
)
});
}
sendButton
.
addEventListener
(
"click"
,
send
)
socket
.
on
(
"chatting"
,
(
data
)
=>
{
const
li
=
document
.
createElement
(
"li"
);
li
.
innerText
=
`
${
data
.
name
}
님이 -
${
data
.
msg
}
`
;
chatlist
.
appendChild
(
li
)
console
.
log
(
data
)
const
{
name
,
msg
,
time
}
=
data
;
const
item
=
new
LiModel
(
name
,
msg
,
time
);
item
.
makeLi
()
displayContainer
.
scrollTo
(
0
,
displayContainer
.
scrollHeight
)
})
console
.
log
(
socket
);
\ No newline at end of file
//console.log(socket);
function
LiModel
(
name
,
msg
,
time
)
{
this
.
name
=
name
;
this
.
msg
=
msg
;
this
.
time
=
time
;
this
.
makeLi
=
()
=>
{
const
li
=
document
.
createElement
(
"li"
);
li
.
classList
.
add
(
nickname
.
value
===
this
.
name
?
"sent"
:
"received"
)
const
dom
=
`<span class="profile">
<span class="user">
${
this
.
name
}
</span>
<img class="image" src="https://placeimg.com/50/50/any" alt="any">
</span>
<span class="message">
${
this
.
msg
}
</span>
<span class="time">
${
this
.
time
}
</span>`
;
li
.
innerHTML
=
dom
;
chatlist
.
appendChild
(
li
)
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment