Skip to content

Commit

Permalink
Merge pull request #5 from pandahwang/design
Browse files Browse the repository at this point in the history
fix: http.ts 요청 주소 backend ip로 변경
  • Loading branch information
pandahwang authored Oct 1, 2024
2 parents 5de65e3 + 786c9e7 commit c3e51a0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy Frontend To EC2

on:
push:
branches:
- dev

jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: SSH(원격 접속)로 EC2에 접속하기
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script_stop: true
script: |
cd /home/ubuntu/la-front-end
git pull origin dev
rm -rf build
npm install
npm run build
sudo fuser -k -n tcp 3000 || true
npx serve -s build -l 3000 > ./front_output.log 2>&1 &
12 changes: 6 additions & 6 deletions src/http.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 로스트아크 전체 직업 통계 데이터 조회
export async function fetchOuterData() {
const response = await fetch('http://localhost:8080/statistics/alluser');
const response = await fetch('http://52.79.232.220:8080/statistics/alluser');
const resData = await response.json();

if(!response.ok){
Expand All @@ -12,7 +12,7 @@ export async function fetchOuterData() {

// 테스트 대상 전체 직업 통계 데이터 조회
export async function fetchData() {
const response = await fetch('http://localhost:8080/statistics/data');
const response = await fetch('http://52.79.232.220:8080/statistics/data');
const resData = await response.json();

if(!response.ok){
Expand All @@ -24,7 +24,7 @@ export async function fetchData() {

export async function postData(url = "", data = {}) {
console.log(data);
const response = await fetch(`http://localhost:8080${url}`, {
const response = await fetch(`http://52.79.232.220:8080${url}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -39,7 +39,7 @@ export async function postData(url = "", data = {}) {
}

export async function getData(url = "") {
const response = await fetch(`http://localhost:8080${url}`);
const response = await fetch(`http://52.79.232.220:8080${url}`);
const resData = await response.json();

if(!response.ok){
Expand All @@ -50,7 +50,7 @@ export async function getData(url = "") {
}

export async function deleteData(url = "", data = {}) {
const response = await fetch(`http://localhost:8080${url}`, {
const response = await fetch(`http://52.79.232.220:8080${url}`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Expand All @@ -62,7 +62,7 @@ export async function deleteData(url = "", data = {}) {
}

export async function updateData(url = "", data = {}) {
const response = await fetch(`http://localhost:8080${url}`, {
const response = await fetch(`http://52.79.232.220:8080${url}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Expand Down

0 comments on commit c3e51a0

Please sign in to comment.