Skip to content
Snippets Groups Projects
Commit f55c8a21 authored by Minseo Lee's avatar Minseo Lee
Browse files

build: localhost version

parent 0ce9259c
Branches main
No related tags found
No related merge requests found
No preview for this file type
.env 0 → 100644
NODE_ENV="production"
File added
a.sh 0 → 100644
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
emails=$(git log --pretty=format:'%ae' | sort | uniq)
for email in $emails; do
total_additions=$(git log --author="$email" --pretty=tformat: --numstat | grep -v 'package-lock.json' | awk '{sum += $1} END {print sum}')
total_deletions=$(git log --author="$email" --pretty=tformat: --numstat | grep -v 'package-lock.json' | awk '{sum += $2} END {print sum}')
commit_count=$(git log --author="$email" --pretty=oneline | grep -v 'package-lock.json' | wc -l)
echo "${NC}Email\t\t:\t$email"
echo "${NC}Commit counts\t: $commit_count"
echo "${GREEN}Added Lines\t:\t$total_additions"
echo "${RED}Deleted Lines\t:\t$total_deletions"
echo
done
index.js 0 → 100644
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const path = require('path');
const app = express();
// API 요청을 위한 프록시 설정
// app.use('/api', createProxyMiddleware({
// target: 'http://localhost:8080',
// changeOrigin: true,
// // secure: true
// }));
// 정적 파일 제공
app.use(express.static(path.join(__dirname, 'build')));
// 모든 나머지 요청을 index.html로 리디렉트
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
// const PORT = process.env.PORT || 3000;
app.listen(80, () => {
console.log(`Server is running on port 80`);
});
No preview for this file type
File added
No preview for this file type
......@@ -5,7 +5,7 @@ import logger from "../utils/logger";
class AdminSocket {
private ioInstance = io(`${SOCKET_URL}/admin`, { withCredentials: true });
private ioInstance = io(`${SOCKET_URL}/api/admin`, { withCredentials: true });
constructor() {
this.ioInstance.on('connect', () => {
......
......@@ -5,7 +5,7 @@ import logger from "../utils/logger";
class Socket {
private ioInstance = io(SOCKET_URL, { withCredentials: true });
private ioInstance = io(SOCKET_URL + '/api', { withCredentials: true });
constructor() {
this.ioInstance.on('connect', () => {
......
......@@ -17,12 +17,12 @@ const DEV_API_URL = 'http://localhost:8080';
const PROD_API_URL = 'https://ajou-eats-api.seunglab.dev';
const DEV_SOCKET_URL = 'ws://localhost:8080';
const PROD_SOCKET_URL = 'wss://ajou-eats-api.seunglab.dev';
// const PROD_SOCKET_URL = 'wss://ajou-eats-api.seunglab.dev';
// const API_URL = process.env.NODE_ENV === 'production' ? PROD_API_URL : DEV_API_URL;
const API_URL = PROD_API_URL;
const API_URL = DEV_API_URL;
// const SOCKET_URL = process.env.NODE_ENV === 'production' ? PROD_SOCKET_URL : DEV_SOCKET_URL;
const SOCKET_URL = PROD_SOCKET_URL;
const SOCKET_URL = DEV_SOCKET_URL;
/**
* @name fetchData
......@@ -42,7 +42,7 @@ async function fetchData<T> (
let status;
try {
request = await fetch(`/api${url}`, {
request = await fetch(`${API_URL}/api${url}`, {
method,
headers: {
'Content-Type': 'application/json',
......
File added
File added
No preview for this file type
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import { FETCH_METHOD, fetchData } from "../../../common/utils/api";
import { getQueryStrings } from "../../../common/utils/query";
import ExitButton from "../module/ExitButton";
......@@ -12,14 +13,16 @@ const SuccessPage: GFC = ({ connector }) => {
const location = useLocation();
useEffect(() => {
if (!location.search || !connector.current) return;
void (async () => {
try {
await connector.current!.post<OrderApprovePostModel>('/order/approve', {
await fetchData<OrderApprovePostModel>('/order/approve', FETCH_METHOD.POST,{
pg_token: getQueryStrings(location.search, 'pg_token'),
payment_id: localStorage.getItem('payment_id'),
});
// await connector.current!.post<OrderApprovePostModel>('/order/approve', {
// pg_token: getQueryStrings(location.search, 'pg_token'),
// payment_id: localStorage.getItem('payment_id'),
// });
} catch (e) {
alert("결제에 실패하였습니다");
console.error(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment