Merge branch 'feature/app' into 'master'
Merge feature/app From feature/app into master See merge request !3
Showing
3 changed files
with
97 additions
and
3 deletions
| 1 | -console.log(new Date()); | 1 | +var http = require('http'); |
| 2 | +var server = http.createServer(); | ||
| 3 | +var port = 80; | ||
| 2 | 4 | ||
| 3 | -require('./zum/zum'); | 5 | +const childProcess = require('child_process'); |
| 4 | -require('./nate/nate'); | 6 | +var list1 = childProcess.execSync('node ./zum/zum.js').toString(); |
| 7 | +var list2 = childProcess.execSync('node ./nate/nate.js').toString(); | ||
| 8 | + | ||
| 9 | +server.listen(port, function(){ | ||
| 10 | + console.log('Server Start, Port : ' + port); | ||
| 11 | +}); | ||
| 12 | + | ||
| 13 | +server.on('request', function(req, res){ | ||
| 14 | + res.writeHead(200, {'Content-Type': 'text/html'}); | ||
| 15 | + res.write("<!DOCTYPE html>"); | ||
| 16 | + res.write("<html>"); | ||
| 17 | + res.write("<head>"); | ||
| 18 | + res.write('<meta charset="UTF-8">'); | ||
| 19 | + res.write("<title>실시간 검색어 모아보기</title>"); | ||
| 20 | + res.write("<style>") | ||
| 21 | + res.write("div {width: 100%;text-align: center;border: 1px solid #003458;} div.left {width: 50%;float: left;box-sizing: border-box;text-align: center;} div.right {width: 50%;float: right;box-sizing: border-box;text-align: center;}") | ||
| 22 | + res.write("</style>") | ||
| 23 | + res.write("</head>"); | ||
| 24 | + res.write("<body>"); | ||
| 25 | + res.write("<div>") | ||
| 26 | + res.write("<h1>실시간 검색어 모아보기</h1>"); | ||
| 27 | + res.write(new Date() + "<br/>"); | ||
| 28 | + res.write("<br/>"); | ||
| 29 | + res.write('<div class="left">') | ||
| 30 | + res.write("<h3>" + list1.split(',')[0].substring(5, list1.split(',')[0].length - 1) + "</h3>"); | ||
| 31 | + res.write(list1.split(',')[1].substring(4, list1.split(',')[1].length - 1) + "<br/>"); | ||
| 32 | + var i = 2; | ||
| 33 | + while(i < list1.split(',').length - 1) { | ||
| 34 | + var str1 = list1.split(',')[i]; | ||
| 35 | + res.write("<b>" + str1.substring(4, str1.length - 1) + "</b>" + "<br/>"); | ||
| 36 | + res.write('<a href="https://www.google.com/search?q=' + str1.substring(7, str1.length - 1) + '">Google</a> '); | ||
| 37 | + res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + str1.substring(7, str1.length - 1) + '">Naver</a> '); | ||
| 38 | + res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + str1.substring(7, str1.length - 1) + '">Daum</a> '); | ||
| 39 | + res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + str1.substring(7, str1.length - 1) + '">Nate</a> '); | ||
| 40 | + res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + str1.substring(7, str1.length - 1) + '">Zum</a><br/>'); | ||
| 41 | + i++; | ||
| 42 | + }; | ||
| 43 | + res.write("<b>" + list1.split(',')[i].substring(4, list1.split(',')[i].length - 4) + "</b>" + "<br/>"); | ||
| 44 | + res.write('<a href="https://www.google.com/search?q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Google</a> '); | ||
| 45 | + res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Naver</a> '); | ||
| 46 | + res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Daum</a> '); | ||
| 47 | + res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Nate</a> '); | ||
| 48 | + res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Zum</a><br/>'); | ||
| 49 | + res.write("<br/>"); | ||
| 50 | + res.write("</div>") | ||
| 51 | + | ||
| 52 | + res.write('<div class="right">') | ||
| 53 | + res.write("<h3>" + list2.split(',')[0].substring(6, list2.split(',')[0].length - 1) + "</h3>"); | ||
| 54 | + res.write("<br/>"); | ||
| 55 | + var j = 1; | ||
| 56 | + while(j < list2.split(',').length - 1) { | ||
| 57 | + var str2 = list2.split(',')[j]; | ||
| 58 | + res.write("<b>" + str2.substring(4, str2.length - 1) + "</b>" + "<br/>"); | ||
| 59 | + res.write('<a href="https://www.google.com/search?q=' + str2.substring(7, str2.length - 1) + '">Google</a> '); | ||
| 60 | + res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + str2.substring(7, str2.length - 1) + '">Naver</a> '); | ||
| 61 | + res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + str2.substring(7, str2.length - 1) + '">Daum</a> '); | ||
| 62 | + res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + str2.substring(7, str2.length - 1) + '">Nate</a> '); | ||
| 63 | + res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + str2.substring(7, str2.length - 1) + '">Zum</a><br/>'); | ||
| 64 | + j++; | ||
| 65 | + }; | ||
| 66 | + res.write("<b>" + list2.split(',')[j].substring(4, list2.split(',')[j].length - 4) + "</b>" + "<br/>"); | ||
| 67 | + res.write('<a href="https://www.google.com/search?q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Google</a> '); | ||
| 68 | + res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Naver</a> '); | ||
| 69 | + res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Daum</a> '); | ||
| 70 | + res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Nate</a> '); | ||
| 71 | + res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Zum</a><br/>'); | ||
| 72 | + res.write("<br/>"); | ||
| 73 | + res.write("</div>") | ||
| 74 | + res.write("</div>") | ||
| 75 | + res.write("</body>"); | ||
| 76 | + res.write("</html>"); | ||
| 77 | + res.end(); | ||
| 78 | +}); | ... | ... |
package-lock.json
0 → 100644
package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "trendingtopics", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "", | ||
| 5 | + "main": "app.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "repository": { | ||
| 10 | + "type": "git", | ||
| 11 | + "url": "http://khuhub.khu.ac.kr/2020105661/TrendingTopics.git" | ||
| 12 | + }, | ||
| 13 | + "author": "", | ||
| 14 | + "license": "ISC" | ||
| 15 | +} |
-
Please register or login to post a comment