버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

Restful API

...

  1. Flowchart

    - 순서도

    Restful API

     

     

    Flowchart (순서도)

  2. 소스코드

    코드 블럭
    titleRestAPI Flowchart 코드
    // initailize
    rankdir=TB
    ;
    
    fontname="맑은 고딕"
    graph [concentrate=true, splines=ortho, nodesep=0.5]
    ; fontname="맑은 고딕"; node
    
    node  [peripheries=0, style=filled, fillcolor=lightyellow, fontcolor=black,fontname="맑은 고딕",fixedsize=true, width=1, height=0.4]
    ;
    
    edge  [fontname="맑은 고딕",fontsize=8,fontcolor=black, labeldistance=1.8]
    ;
    
    start [shape=record, style="filled,rounded", label="HTTP Request", width=1.7
    ,
    ]
    ;
    
    check [shape=rect, style="filled", label="Check HTTP Method\n(GET|POST|PUT|DELETE)", fillcolor="#8ECCFC", width=1.7,height=0.7]
    ;
    
    end	  [shape=record, style="filled,rounded", label="HTTP Response", width=1.7
    ,
    ]
    ;
    
    
    
    {
      rank=same;
    
    match
      match      [shape=rect, style="filled", label="Find Matching API URL", fillcolor="#8ECCFC", width=1.7, height=0.7]
    ;
    
      is_url
         [shape=diamond, style="filled",label="URL\nFound?", fillcolor="#8ECCFC", width=1.2, height=1.2]
    ;
    
      is_protect
     [shape=diamond, style="filled",label="Protected\nAPI?", fillcolor="#8ECCFC", width=1.2, height=1.2
    ]
    ]
    ;
    
    }
    
    subgraph cluster_a
    
    {
      color=white;
      {
        rank=same;
        auth    [shape=diamond, style="filled",label="Authenticated?", fillcolor="#8ECCFC", width=1.2, height=1.2
    ]
    ]
        error   [shape=rect, style="filled", label="ERROR", fillcolor="#FF682A"]
      }
    }
    
    subgraph cluster_b
    { color=white;
    
    {
    rank=same; result [shape=rect, style="filled", label="RESULT", fillcolor="#84FA3F"]
    
    
    method [shape=rect,
     
    style="filled", label="API Method",
     
    fillcolor=yellow] } } start -> check check -> match match -> is_url is_url -> is_protect [headlabel="YES", color=green] is_url -> error [headlabel="NO", color=red, fontcolor=red] is_protect -> auth [headlabel="YES", color=green] is_protect -> method [headlabel="NO", color=green] auth -> error [headlabel="NO", color=red, fontcolor=red] auth -> method [headlabel="YES", color=green] method -> result {error, result} -> end

    소스코드 (소스 정리)

    코드 블럭
    titleRestAPI Flowchart 코드
    rankdir = TB; fontname = "맑은 고딕"; fontcolor= black; graph [concentrate=true, splines=ortho, nodesep=0.5]; node [peripheries=0, style=filled, fixedsize=true, width=1.7, height=0.5, fillcolor="#8ECCFC"]; edge [fontsize=8, labeldistance=1.8]; start [shape=record, style="filled,rounded", fillcolor=lightyellow, label="HTTP Request"]; check [shape=rect, fillcolor="#8ECCFC", label="Check HTTP Method\n(GET|POST|PUT|DELETE)"]; end [shape=record, style="filled,rounded", fillcolor=lightyellow, label="HTTP Response"]; { rank=same; match [shape=rect, label="Find Matching API URL"]; is_url [shape=diamond, height=0.7, label="URL\nFound?"]; is_protect [shape=diamond, height=0.7, label="Protected\nAPI?"]; } subgraph cluster_a { color=white; { rank=same; auth [shape=diamond, height=0.7, label="Authenticated?"] error [shape=rect, fillcolor="#FF682A", label="ERROR"] } } subgraph cluster_b { color=white; { rank=same; result [shape=rect, fillcolor="#84FA3F", label="RESULT"] method [shape=rect, fillcolor="yellow", label="API Method"] } } start -> check check -> match match
    color=white;
      {
        rank=same;
        result  [shape=rect, style="filled", label="RESULT", fillcolor="#84FA3F"]
        method  [shape=rect, style="filled", label="API Method", fillcolor=yellow]
      }
    }
    
    // Draw flow
    start -> check
    check -> match
    match -> is_url
    is_url
     
    -> is_protect  
    [headlabel="YES", color=green]
    is_url
     
    -> error
           
    [headlabel="NO", color=red, 
    color
    fontcolor=red]
    is_protect
     -> auth
        [headlabel="YES", color=green]
    is_protect
     
    -> method
      
    [headlabel="NO", color=red, 
    color
    fontcolor=
    green
    red]
    auth
     
    -> error
             [headlabel="NO", color=red, 
    color
    fontcolor=red]
    auth
     -> method
            
    [headlabel="YES", color=green]
    method 
    -> result
    {error, result} -> end
    PSDA 자동 번역
  3. Flowchart (순서도)

  4. 소스코드

    코드 블럭titlePSDA 자동 번역 순서도 소스코드
    rankdir  = TB;
    fontname = "맑은 고딕";
    graph           [concentrate=true, splines=ortho, nodesep=0.5];
    node            [peripheries=0, style=filled, fixedsize=true, width=2.0, height=0.5, fillcolor=darkolivegreen1];
    edge            [fontsize=8,    labeldistance=2.8];
    
    subgraph cluster_a {
        color=white;
        {
            start           [shape=record,  style="filled,rounded", fillcolor=lightyellow, label="CRON 시작"];
            cron_duplicate  [shape=diamond, height=0.7,             fillcolor="#8ECCFC",   label="동작중인 CRON이\n존재하지 않는가?"];
            cron_flag_on    [shape=rect,                            fillcolor=orange,      label="CRON 수행 flag on"];
            do_standby_text [shape=diamond, height=0.7,             fillcolor="#8ECCFC",   label="텍스트 추출 완료\n상품이 존재하는가?"];
        }
        find_psd_file   [shape=rect,                            label="상품의 텍스트\n추출 완료 PSD 파일 수집"];
        find_ori_layer  [shape=rect,                            label="PSD 원문 레이어 텍스트 수집"];
        {
            rank=same;
            do_standby_lang [shape=diamond, height=0.7,             fillcolor="#8ECCFC",   label="해당 레이어에 대한\n자동번역이 필요한가?"];
            update_trans    [shape=rect,                            fillcolor=orange,      label="DB 번역문/타입 업데이트"];
        }
    }
    
    subgraph cluster_b {
        color=blue;    
        {
            rank=same;
            exist_mall_dic [shape=diamond, height=0.7, fillcolor="#8ECCFC", label="문단/문장에 대한 몰사전\n번역이 존재하는가?"];
            make_token     [shape=rect,                            label="문장을 토큰 단위 분해"];
        }
        exist_tool_dic  [shape=diamond, height=0.7,             fillcolor="#8ECCFC",   label="번역툴 번역이\n존재하는가?"];
        {
            rank=same;
            trans_mall_dic  [shape=rect,                            label="몰사전 번역"];
            trans_google    [shape=rect,                            label="구글 번역"];
            trans_tool_dic  [shape=rect,                            label="번역사전 번역"];
        }
        trans_result [shape=rect, label="번역 문장 및 번역 타입 수집"];
    }
    
    subgraph cluster_d {
        color=white;
        cron_flag_off   [shape=rect,                            fillcolor=orange,      label="CRON 수행 flag off"];
        end	            [shape=record,  style="filled,rounded", fillcolor=lightyellow, label="CRON 종료"];
    }
    
    start           -> cron_duplicate
    cron_duplicate  -> end              [headlabel="No",  color=red]
    cron_duplicate  -> cron_flag_on     [headlabel="Yes", color=green]
    cron_flag_on    -> do_standby_text
    do_standby_text -> cron_flag_off    [headlabel="No",  color=red]
    do_standby_text -> find_psd_file    [headlabel="Yes", color=green]
    find_psd_file   -> find_ori_layer  
    find_ori_layer  -> do_standby_lang 
    do_standby_lang -> exist_mall_dic   [headlabel="          Yes (번역정보 API 호출)", color=green]
    do_standby_lang -> do_standby_text  [headlabel="No",  color=red]
    exist_mall_dic  -> trans_mall_dic   [headlabel="Yes", color=green]
    exist_mall_dic  -> make_token       [headlabel="No",  color=red]
    make_token      -> exist_tool_dic
    exist_tool_dic  -> trans_tool_dic   [headlabel="Yes", color=green]
    exist_tool_dic  -> trans_google     [headlabel="No",  color=red]
    {trans_mall_dic, trans_tool_dic, trans_google} -> trans_result
    trans_result    -> update_trans     [headlabel="                    (번역정보 API 결과 반환)"]
    update_trans    -> do_standby_lang
    cron_flag_off   -> end
  5. Sequence Diagram - 시퀀스 다이어그램

 

 해당 wiki는 자꾸 까 먹어서 새로 찾는 부분이 많이 발생하기 때문에 기본적인 부분에 대해서 정리를 합니다.