Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
nodejs_60_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Piyunggur Sonsongklin
nodejs_60_2
Commits
c99bfdbe
Commit
c99bfdbe
authored
Feb 06, 2018
by
Piyunggur Sonsongklin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git clone
http://projectcs.sci.ubu.ac.th/piyunggur/nodejs_60_2.git
parent
06c49de2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
inidex.js
week03/inidex.js
+44
-0
package.json
week03/package.json
+11
-0
server.js
week03/server.js
+7
-0
No files found.
week03/inidex.js
0 → 100644
View file @
c99bfdbe
const
rl
=
require
(
'readline'
);
const
io
=
rl
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
});
// io.question('กรอกชื่อ ', (name,what) => {
// io.question('ปีเกิด พ.ศ ', (year) => {
// year = 2561 - year;
// io.question('ขอเบอรโทรด่วน ', (phone) => {
// console.log(`คุณ ${name} อายุ ${year}.`);
// io.close();
// });
// });
// });
// var i = 0;
// var name = ""; var year =""; var phone= "";
// io.on('line',(line)=>{
// if(i == 0){
// name = line;
// }else if(i == 1){
// year = line;
// }else{
// phoen = line;
// console.log('you '+ name + ' your old ' + (2561-year) + 'and your phone ' + phone);
// io.close();
// }
// i++;
// });
// io.on('close',()=>io.close());
var
i
=
0
;
var
input
=
[];
var
type
=
[
'name'
,
'year'
,
'phone'
];
io
.
on
(
'line'
,(
line
)
=>
{
input
.
push
(
line
);
if
(
i
==
2
){
// var year = parseInt(input[1]);
console
.
log
(
'สวัสดีคุณ '
+
input
[
0
]
+
' เบอร์ '
+
input
[
2
]
+
' อายุ '
+
(
2561
-
parseInt
(
input
[
1
]))
+
' ปี'
);
io
.
close
();
}
i
++
;
});
\ No newline at end of file
week03/package.json
0 → 100644
View file @
c99bfdbe
{
"name"
:
"week03"
,
"version"
:
"1.0.0"
,
"description"
:
"การบ้านสัปหาด์ที่3"
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
}
week03/server.js
0 → 100644
View file @
c99bfdbe
const
http
=
require
(
'http'
)
http
.
createServer
((
req
,
res
)
=>
{
res
.
writeHead
(
200
,{
'Content-type'
:
'text/html'
});
res
.
end
();
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment