From 3a256a813cad192e13a846b69c7557c81f228db6 Mon Sep 17 00:00:00 2001 From: insang-hmogara-pc Date: Mon, 14 Sep 2026 14:37:56 +0900 Subject: [PATCH] Initial commit --- apiserver/app/__pycache__/app.cpython-38.pyc | Bin 0 -> 315 bytes .../app/__pycache__/route.cpython-38.pyc | Bin 0 -> 317 bytes .../__pycache__/router_main.cpython-38.pyc | Bin 0 -> 284 bytes apiserver/app/__pycache__/url.cpython-38.pyc | Bin 0 -> 360 bytes apiserver/app/app.py | 6 ++++ apiserver/app/route.py | 6 ++++ apiserver/app/router_main.py | 7 +++++ apiserver/app/url.py | 9 ++++++ .../__pycache__/controller.cpython-38.pyc | Bin 0 -> 356 bytes .../__pycache__/router.cpython-38.pyc | Bin 0 -> 1017 bytes .../__pycache__/url.cpython-38.pyc | Bin 0 -> 428 bytes apiserver/app/weddingcard/controller.py | 10 ++++++ .../__pycache__/service.cpython-38.pyc | Bin 0 -> 812 bytes apiserver/app/weddingcard/guestbook/model.py | 8 +++++ .../app/weddingcard/guestbook/service.py | 19 ++++++++++++ .../library/db/__pycache__/db.cpython-38.pyc | Bin 0 -> 554 bytes .../app/weddingcard/library/db/config.py | 11 +++++++ apiserver/app/weddingcard/library/db/db.py | 26 ++++++++++++++++ apiserver/app/weddingcard/router.py | 29 ++++++++++++++++++ apiserver/app/weddingcard/url.py | 13 ++++++++ apiserver/wsgi/mod.wsgi | 3 ++ 21 files changed, 147 insertions(+) create mode 100644 apiserver/app/__pycache__/app.cpython-38.pyc create mode 100644 apiserver/app/__pycache__/route.cpython-38.pyc create mode 100644 apiserver/app/__pycache__/router_main.cpython-38.pyc create mode 100644 apiserver/app/__pycache__/url.cpython-38.pyc create mode 100644 apiserver/app/app.py create mode 100644 apiserver/app/route.py create mode 100644 apiserver/app/router_main.py create mode 100644 apiserver/app/url.py create mode 100644 apiserver/app/weddingcard/__pycache__/controller.cpython-38.pyc create mode 100644 apiserver/app/weddingcard/__pycache__/router.cpython-38.pyc create mode 100644 apiserver/app/weddingcard/__pycache__/url.cpython-38.pyc create mode 100644 apiserver/app/weddingcard/controller.py create mode 100644 apiserver/app/weddingcard/guestbook/__pycache__/service.cpython-38.pyc create mode 100644 apiserver/app/weddingcard/guestbook/model.py create mode 100644 apiserver/app/weddingcard/guestbook/service.py create mode 100644 apiserver/app/weddingcard/library/db/__pycache__/db.cpython-38.pyc create mode 100644 apiserver/app/weddingcard/library/db/config.py create mode 100644 apiserver/app/weddingcard/library/db/db.py create mode 100644 apiserver/app/weddingcard/router.py create mode 100644 apiserver/app/weddingcard/url.py create mode 100644 apiserver/wsgi/mod.wsgi diff --git a/apiserver/app/__pycache__/app.cpython-38.pyc b/apiserver/app/__pycache__/app.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bd2b4fc5cbcd42f7a049b075a0b2c736eb985931 GIT binary patch literal 315 zcmYjLF;2rk5Zt}^Qz2ivym%;sHw1a*R;;sq&b~T==QH}be{kF WpUh~#YdhL|H(JUGQd75E2KgFfg0 literal 0 HcmV?d00001 diff --git a/apiserver/app/__pycache__/route.cpython-38.pyc b/apiserver/app/__pycache__/route.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a9a06125ec8254d74ebd9fcce71e64a463f6035f GIT binary patch literal 317 zcmYjLJx{|h5WTbGD13BeW)4IB2M|I+VqoZkSiD$K?@%io64|s7GyD)3`Ab=u_zRsl zr$c+vJ>PqJ?|e_Q*(pe!Ts$n-^8RLWTw2Jjbh;8CAPmr=Lj*=vALumeuY%M!lBVJl zL@{I@p)UW#4>gYFJ~ZiNhjy8T<3b^K(y0(2l#p6Dv*HlCABb5z!0ys+n`nn&uuZ>C z9Jd^0>TT>cZ#?hc$FnKuhb{)n*`x$O#Zqulm(D!rJ7QMH%KO)*W$&Gq9iy3+OwPlP X`^il9>$am!;G2AL$_vl2QWgFK?bAMk literal 0 HcmV?d00001 diff --git a/apiserver/app/__pycache__/router_main.cpython-38.pyc b/apiserver/app/__pycache__/router_main.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc431be3e2d38fe162e33e2c29cdd930b124f8aa GIT binary patch literal 284 zcmYjKyG{f#49sJ9Z+V=A_y>w@*oG1z1QG=W4WdaCg^M`_lD){ey%jZl12vTVQd%m0 z;VK*R@;@YzbINo=V43Bf1+I7yO7Oykm!VRUGvH9a zaMeKbJ_GsKd~nj`E$gapanT>MMgo(SiY*g z39NO)a$(S7MU&iWJ(vJmXK7+ohX_lT$gc1IPJS|+l>-H~NBzcNKTT6_qDz1qKoUZ1751nRo>z z&gno-y3gPJe0S%EOH~e129JQCODH~axaSXhqa=BQQdmmZJ9(p`IlS|4so-4sw`m@TIL2E+^}~s!(Q+h zSg~?3(|ie1T%6$dOdl-iVHmV+H=Uz{BWA7UP3P_NxL7;y8#6TIF%4rSgOC*Xs>n+9 z7*3;*rLd90$H&Z=ovocQW5lycMNPkVljeW(ktI|6W!+%!-Bmcg%NTN*%S>kQ2mX~x A9smFU literal 0 HcmV?d00001 diff --git a/apiserver/app/app.py b/apiserver/app/app.py new file mode 100644 index 0000000..f72ebc1 --- /dev/null +++ b/apiserver/app/app.py @@ -0,0 +1,6 @@ +from flask import Flask +app = Flask(__name__) + +@app.route('/') +def hello_world(): + return 'hello' \ No newline at end of file diff --git a/apiserver/app/route.py b/apiserver/app/route.py new file mode 100644 index 0000000..f72ebc1 --- /dev/null +++ b/apiserver/app/route.py @@ -0,0 +1,6 @@ +from flask import Flask +app = Flask(__name__) + +@app.route('/') +def hello_world(): + return 'hello' \ No newline at end of file diff --git a/apiserver/app/router_main.py b/apiserver/app/router_main.py new file mode 100644 index 0000000..9205840 --- /dev/null +++ b/apiserver/app/router_main.py @@ -0,0 +1,7 @@ +from flask import Flask, Blueprint + +from weddingcard import router as weddingcard + +app= Flask(__name__) + +app.register_blueprint(weddingcard.app) \ No newline at end of file diff --git a/apiserver/app/url.py b/apiserver/app/url.py new file mode 100644 index 0000000..ecd0cfd --- /dev/null +++ b/apiserver/app/url.py @@ -0,0 +1,9 @@ +from flask import Flask + +from weddingcard import url as weddingcard + +app = Flask(__name__) + +@app.route('/weddingcard') +def hello_world(): + return weddingcard \ No newline at end of file diff --git a/apiserver/app/weddingcard/__pycache__/controller.cpython-38.pyc b/apiserver/app/weddingcard/__pycache__/controller.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7cdf4e87d1d52e8d9e6298c6a9658b3cbacce4b GIT binary patch literal 356 zcmYk0J5Izv42I{C=aNN;TZDpe0EEyM6bMnU+9pku&3L1*lVs#18=$4;4p4HXp`_vp zR5%4vEcv%T$^Pxla=Bm>>$BV9i|Y3T^Kc2SDZ3SkVv1{4^OV;j6?|f$W$mPrGvMI9 z^3(&NB)G~^?wd?~@ZJNEkKPBTX>ZM9|A%~7EUbH@^KNg$l^(!g)$}p9eg}A{3b02b zC{;COk)wKvk{Qv|VnCf4gkAM?ABWc6O-3ll79~jbCfam7f2A6fK S1`Su7_Pc=OL_{JG$MO$&pJ6`$ literal 0 HcmV?d00001 diff --git a/apiserver/app/weddingcard/__pycache__/router.cpython-38.pyc b/apiserver/app/weddingcard/__pycache__/router.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71840929358689459a08548cb6697484a6610f7d GIT binary patch literal 1017 zcmbW0y^ho{5XWt2vzw3o1P*wGl@NIW1PG`ot~t@9iNcO=6Xj1W2PbaxDS1u3`APu<$Wl}? zm6b}B6rjK>y=stpQfLJO?Sl`)Z(cgo!1Y;>uRS2G@!{q?jTjcEcW6uAH9@wlHkyn5Rl0~~POLE@AM3x~-0KRc|u zV}Kr&9pueu{S$}BdB1RW2)fj*KH^Y^`^tmVIZ>WERL)PA6XTzkd2@k$yXbM?>p}j@ zOps-pywX`_JbE9--#-d|5cZak4+_~m@?wXmCU{Y8p)2)E{s$W7&(&B>2Z4+{r>j8z E0?%5*N&o-= literal 0 HcmV?d00001 diff --git a/apiserver/app/weddingcard/__pycache__/url.cpython-38.pyc b/apiserver/app/weddingcard/__pycache__/url.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d26dcaa7f741bb3c2221d21e84c5a651ba317b0 GIT binary patch literal 428 zcmYk3u};G<5Qgm}PMtKVDi*}Zn5B6E1QZDd1RaXHc!@%Mt)e=OPFy-5PVz5*zs|pX@+^)+g7tNNUtCc_zB~9|4B;AABT*!gRFR4bS~hKb-kP<1Iy-JoN+MRxG183G%|xdJL7eBH>?Q$P8lEB@+@2B6=a!ZjaKDa@X7e` zHk(Z!tea~sP)ZT!QXbnHofq&)%%IEbHpRvU%mxhZbh-s8%hjUDjZE>? cBmH9e1y0i{xWu0zO@uO}Lnm?v?g{12FSf~VJpcdz literal 0 HcmV?d00001 diff --git a/apiserver/app/weddingcard/controller.py b/apiserver/app/weddingcard/controller.py new file mode 100644 index 0000000..0b74819 --- /dev/null +++ b/apiserver/app/weddingcard/controller.py @@ -0,0 +1,10 @@ +from flask import Flask, Blueprint + +from guestbook import service as guestbook + +app= Flask(__name__) + +URL = Blueprint('weddingcard', __name__, url_prefix= '/weddingcard') + + +app.register_blueprint(guestbook.app) \ No newline at end of file diff --git a/apiserver/app/weddingcard/guestbook/__pycache__/service.cpython-38.pyc b/apiserver/app/weddingcard/guestbook/__pycache__/service.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d026492830bca2003185508bbf029095a38ab68e GIT binary patch literal 812 zcma))y-ve05P)qbY16a;gm{TAWMn}IK_`YT2nl6CN^_=!I!!pIe>)EXBd?T|iC19a zuBZ@!RMnR6Cpmw2xywx$27=b$?kYW!LcFunT#B4?I`)Vp%LuV6&dt@N@=Ii|Tds^(K(tuEpm`G*2*EEEZ8x zW>(`|BUxp%&;Z$VoF)j-ct*EIMKOsuAWQXexvITv3VPY%T%1%$2)iWM*l^k3jq8?$-2(0rh|dPh_HJOOoNeKT#My6f+24)Z0&R4q z8y)zW46b{zN2tRFn*DxQyZlSk-n~ie1iAfjV6qV=xH^Ura;uRi69@LmBqn{(`3gOL n$}?Iw82RIoD@A7ht$>r){%Kyo%;+;7qCFtt%N}p#JKy^YltzHF literal 0 HcmV?d00001 diff --git a/apiserver/app/weddingcard/guestbook/model.py b/apiserver/app/weddingcard/guestbook/model.py new file mode 100644 index 0000000..beb3550 --- /dev/null +++ b/apiserver/app/weddingcard/guestbook/model.py @@ -0,0 +1,8 @@ +from flask import request +from flask_restx import Resource, Api, Namespace + +api= Namespace('guestbook') + +@api.route('/') +def index(): + return 'hi' \ No newline at end of file diff --git a/apiserver/app/weddingcard/guestbook/service.py b/apiserver/app/weddingcard/guestbook/service.py new file mode 100644 index 0000000..cc95b1c --- /dev/null +++ b/apiserver/app/weddingcard/guestbook/service.py @@ -0,0 +1,19 @@ +import json +from flask import jsonify +from ..library.db import db as DB +from sqlalchemy import text + +def index(): + return DB.test() + +def get(): + return 'get' + +def post(): + return 'post' + +def put(): + return 'put' + +def delete(): + return 'delete' \ No newline at end of file diff --git a/apiserver/app/weddingcard/library/db/__pycache__/db.cpython-38.pyc b/apiserver/app/weddingcard/library/db/__pycache__/db.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..63134ef7f7a123eb3babe8803fbb164be61ecc3e GIT binary patch literal 554 zcmYjP&2AGh5VoEDBPCEOBsfOmv>dXC2&o5DRVt?*dO-+j51?I-lWenDFJo_)M9B%R zNIXJw>?`@&6HkBy7iLo`W$gLp*E9CW9|nUyBl`X6T>j*Y-FC)42{KNJ%~Jwkz)O}g z5YYS1QV#q*i@jeIVHdK)d+L!A5}y&9Qv%B_DZ4ud9{3Ra@HcGDt_Asfm)@3d_?ln) z5Nsq9hl{293rvyptyFzbm9Y+c{mRzAD*Rl|~a~seD;Fzs91naW5S} z{`r5ALRWY|!*KyB)0Fmx;bSuYjFYPjleTS>tS;!%R|-k1lf73ZWszfs%LH=Tqk8E) zOV{n@Zk`h`?s0Ly{s!SA-scf5d_u8U-~$pneb;dh4k_TGw+jtTsZQueFw=d3Nc;nw Ch>{Bc literal 0 HcmV?d00001 diff --git a/apiserver/app/weddingcard/library/db/config.py b/apiserver/app/weddingcard/library/db/config.py new file mode 100644 index 0000000..0b60e1e --- /dev/null +++ b/apiserver/app/weddingcard/library/db/config.py @@ -0,0 +1,11 @@ +# /config.py + +db_weddingcard= { + 'user': 'insang', + 'password': 'Whtkd530823#', + 'host': 'localhost', + 'port': '3306', + 'database': 'weddingcard', +} + +url= "mysql+mysqlconnector://insang:Whtkd530823#@localhost:3306/weddingcard?charset=utf8mb4" \ No newline at end of file diff --git a/apiserver/app/weddingcard/library/db/db.py b/apiserver/app/weddingcard/library/db/db.py new file mode 100644 index 0000000..9d593d1 --- /dev/null +++ b/apiserver/app/weddingcard/library/db/db.py @@ -0,0 +1,26 @@ +import pymysql, json, pprint +from sqlalchemy import text + +def test(): + db_connection = pymysql.connect( + user= 'insang', + passwd= 'Whtkd530823#', + host= 'insang.duckdns.org', + db= 'weddingcard', + charset= 'utf8' + ) + cursor= db_connection.cursor(pymysql.cursors.DictCursor) + cursor.execute("select * from guestbook") + # result= json.dumps(cursor.fetchall(), ensure_ascii=True) + result= cursor.fetchall() + return MyPrettyPrinter().pprint(result) + + +class MyPrettyPrinter(pprint.PrettyPrinter): + def format(self, _object, context, maxlevels, level): + if isinstance(_object, str): + return "'%s'" % _object.encode('utf8'), True, False + elif isinstance(_object, str): + _object = str(_object, 'utf8') + return "'%s'" % _object.encode('utf8'), True, False + return pprint.PrettyPrinter.format(self, _object, context, maxlevels, level) \ No newline at end of file diff --git a/apiserver/app/weddingcard/router.py b/apiserver/app/weddingcard/router.py new file mode 100644 index 0000000..89c3b95 --- /dev/null +++ b/apiserver/app/weddingcard/router.py @@ -0,0 +1,29 @@ +from flask import request, Blueprint + +from .guestbook import service as guestbook + +app = Blueprint('weddingcard', __name__, url_prefix= '/weddingcard') + +# region guestbook section + +@app.route('/guestbook/') +def index(): + return guestbook.index() + +@app.route('/guestbook/get') +def get(): + return guestbook.get() + +@app.route('/guestbook/post') +def post(): + return guestbook.post() + +@app.route('/guestbook/put') +def put(): + return guestbook.put() +@app.route('/guestbook/delete') +def delete(): + return guestbook.delete() + +# endregion + diff --git a/apiserver/app/weddingcard/url.py b/apiserver/app/weddingcard/url.py new file mode 100644 index 0000000..cfbb7cc --- /dev/null +++ b/apiserver/app/weddingcard/url.py @@ -0,0 +1,13 @@ +from flask import Flask, Blueprint +from flask_restx import Resource, Api + +from guestbook import model as guestbook + +# region 상수 선언 +NAME_URL= __name__.split('.')[0] +# endregion + +app = Blueprint(NAME_URL, __name__, url_prefix= '/' + NAME_URL) +api = Api(app) + +api.add_namespace(guestbook, '/guestbook') \ No newline at end of file diff --git a/apiserver/wsgi/mod.wsgi b/apiserver/wsgi/mod.wsgi new file mode 100644 index 0000000..8139357 --- /dev/null +++ b/apiserver/wsgi/mod.wsgi @@ -0,0 +1,3 @@ +import sys +sys.path.insert(0, '/var/www/apiserver/app') +from router_main import app as application \ No newline at end of file -- 2.43.0