Showing
1 changed file
with
32 additions
and
0 deletions
| 1 | +<<<<<<< HEAD:chatbot.js | ||
| 1 | var express = require('express'); | 2 | var express = require('express'); |
| 2 | const request = require('request'); | 3 | const request = require('request'); |
| 3 | const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' | 4 | const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' |
| ... | @@ -105,3 +106,34 @@ try { | ... | @@ -105,3 +106,34 @@ try { |
| 105 | console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); | 106 | console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); |
| 106 | console.log(error); | 107 | console.log(error); |
| 107 | } | 108 | } |
| 109 | +======= | ||
| 110 | + | ||
| 111 | +const config =require('./config') | ||
| 112 | +const mongoose = require("mongoose"); | ||
| 113 | +const connect = mongoose.connect(config.url, | ||
| 114 | + { | ||
| 115 | + useNewUrlParser: true, | ||
| 116 | + useUnifiedTopology: true, | ||
| 117 | + }) | ||
| 118 | + .then(() => console.log("DB : Succesfully Connected")) | ||
| 119 | + .catch((err) => console.log(err.message)); | ||
| 120 | + | ||
| 121 | + | ||
| 122 | +/* | ||
| 123 | +const { MongoClient } = require("mongodb"); | ||
| 124 | +const config =require('./config') | ||
| 125 | +const client = new MongoClient(config.url); | ||
| 126 | +async function run() { | ||
| 127 | + try { | ||
| 128 | + await client.connect(); | ||
| 129 | + console.log("Connected correctly to server"); | ||
| 130 | + } catch (err) { | ||
| 131 | + console.log(err.stack); | ||
| 132 | + } | ||
| 133 | + finally { | ||
| 134 | + await client.close(); | ||
| 135 | + } | ||
| 136 | +} | ||
| 137 | +run().catch(console.dir); | ||
| 138 | +*/ | ||
| 139 | +>>>>>>> 86b0ca0 (Modify index.js file):index.js | ... | ... |
-
Please register or login to post a comment