- https://console.cloud.google.com/ ์ ์
- ์ ํ๋ก์ ํธ ์์ฑ (์: "๋ผ๋ SQL Practice")
- ์ผ์ชฝ ๋ฉ๋ด โ "APIs & Services" โ "OAuth consent screen"
- User Type: External ์ ํ
- ์ฑ ์ ๋ณด ์
๋ ฅ:
- App name: ๋ผ๋๋ฅผ ์ํ ์ฟผ๋ฆฌํ ์คํธ ํ๋ซํผ
- User support email: ๋ณธ์ธ ์ด๋ฉ์ผ
- Developer contact: ๋ณธ์ธ ์ด๋ฉ์ผ
- Scopes ์ถ๊ฐ:
.../auth/userinfo.email.../auth/userinfo.profile
- Test users ์ถ๊ฐ (๊ฐ๋ฐ ์ค์๋ ๋ณธ์ธ ์ด๋ฉ์ผ)
- "Credentials" โ "Create Credentials" โ "OAuth client ID"
- Application type: Web application
- ์ด๋ฆ: SQL Practice Web Client
- Authorized redirect URIs ์ถ๊ฐ:
http://localhost:3001/auth/google/callback https://your-cloudflare-url.trycloudflare.com/auth/google/callback - "Create" ํด๋ฆญ
- Client ID์ Client Secret ๋ณต์ฌ
/home/sql/server/.env ํ์ผ์ ์ด์ด์:
GOOGLE_CLIENT_ID=๋ณต์ฌํ_ํด๋ผ์ด์ธํธ_ID
GOOGLE_CLIENT_SECRET=๋ณต์ฌํ_์ํฌ๋ฆฟ
SESSION_SECRET=๋๋คํ_๋น๋ฐํค_์์ฑ
CALLBACK_URL=http://localhost:3001/auth/google/callbackcd /home/sql
pkill -f "node.*server"
cd server && NODE_OPTIONS="--max-old-space-size=8192" node server.js &๋ธ๋ผ์ฐ์ ์์:
- http://localhost:3001/auth/google ์ ์
- ๊ตฌ๊ธ ๊ณ์ ์ ํ
- ๊ถํ ์น์ธ
- ๋ฉ์ธ ํ์ด์ง๋ก ๋ฆฌ๋ค์ด๋ ํธ
- ๋ก๊ทธ์ธ ์๋ฃ!
- ๋ชจ๋ ์ฟผ๋ฆฌ๊ฐ ์๋์ผ๋ก
query_logsํ ์ด๋ธ์ ์ ์ฅ๋จ - ๋ก๊ทธ์ธํ ์ฌ์ฉ์๋ง ๋ณธ์ธ์ ๋ก๊ทธ ํ์ธ ๊ฐ๋ฅ
curl http://localhost:3001/api/logscurl http://localhost:3001/api/stats- id: ์ฌ์ฉ์ ID
- google_id: ๊ตฌ๊ธ ID (๊ณ ์ )
- email: ์ด๋ฉ์ผ
- name: ์ด๋ฆ
- profile_picture: ํ๋กํ ์ฌ์ง URL
- created_at: ๊ฐ์ ์ผ
- last_login: ๋ง์ง๋ง ๋ก๊ทธ์ธ
- id: ๋ก๊ทธ ID
- user_id: ์ฌ์ฉ์ ID
- query_text: ์คํํ ์ฟผ๋ฆฌ
- execution_time: ์คํ ์๊ฐ (ms)
- row_count: ๋ฐํ๋ ํ ์
- success: ์ฑ๊ณต ์ฌ๋ถ
- error_message: ์๋ฌ ๋ฉ์์ง (์คํจ ์)
- created_at: ์คํ ์๊ฐ
GET /auth/google- ๊ตฌ๊ธ ๋ก๊ทธ์ธ ์์GET /auth/google/callback- ๋ก๊ทธ์ธ ์ฝ๋ฐฑGET /auth/logout- ๋ก๊ทธ์์GET /api/user- ํ์ฌ ์ฌ์ฉ์ ์ ๋ณด
GET /api/logs?limit=50- ์ฟผ๋ฆฌ ํ์คํ ๋ฆฌ (์ต๊ทผ 50๊ฐ)GET /api/stats- ์ฌ์ฉ์ ํต๊ณ
POST /api/query- ์ฟผ๋ฆฌ ์คํ (์๋ ๋ก๊น )GET /api/schema- ํ ์ด๋ธ ์คํค๋งGET /api/sample/:column- ์ํ ๋ฐ์ดํฐ