티스토리 뷰


NGROK

다운로드를 받으면 exe파일 달랑 하나다.

shell모드로 실행해야 하는것.


1,2,3,4번 대로 실행을


하면 된다.


ngrok http 80


이런식으로 실행.


웹 서버를 주소화 해서 https와 http로 보내주는 역할인지라


웹 서버는 본인이 또 만들어야 한다


nodejs - 코드로는



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
var express = require('express'),
    http = require('http'),
    path = require('path');
var bodyParser = require('body-parser'),
    cookieParser = require('cookie-parser'),
    errorHandler = require('errorHandler');
var clova = require('./clova/clova_icnDeparture/functions/index.js');
var app = express();
//  port
app.set('port', process.env.PORT || 3000);
// body parser 이용해서 파싱
app.use(bodyParser.urlencoded({
    extended: false
}));
// application/json 파싱
app.use(bodyParser.json());
// this is start area
var router = express.Router();
router.route('/').get(function (req, res) {
    res.send("Test on");
});
//exports 로 빼기 
router.route('/clova').post(function (req, res) {
  return clova.clova_icn(req,res);
});
//exports 로 빼기 
router.route('/clova').get(function (req, res) {
  res.send(clova.clova_icn(req,res));
});
app.use('/', router);
http.createServer(app).listen(3000function () {
    console.log('server is now start port 3000 ready');
});
 
cs



이런식으로 쓴다.


clova Google cloud에 올리기 전에 테스트로 ngrok을 사용했는데

deploy할때 기다릴 필요없이 코드만 바로 고치고 alt r(atom)을 했다.


exports로 뺀 코드라 저렇게 하면 바로 사용이 가능하다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함