app.js 884 Bytes
var express = require('express');

var http = require('http');

var bodyParser = require('body-parser');

var app = express();

app.get('/keyboard', function(req,res){

    var data ={
        'type': 'buttons',
        'buttons': ['질문','컬러','정보']
    };

    res.json(data);
});

app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());

app.post('/message',function(req,res){

    var msg = req.body.content;
    console.log('전달받은 메세지: '+msg);

    var send ={};

    switch(msg){
        case 'pink':
            send = {

            }
            break;
        
        case 'orange':
            send ={

            }
            break;

        default:
            send = {

            }
            break;
    }

    res.json(send);
})

http.createServer(app).listen(9090,function(){
    console.log('서버실행중..');
});