Commit fb983a82 authored by Yoon, Daeki's avatar Yoon, Daeki 😅
Browse files

server root path

parent d604ed75
import express from 'express' import express from "express";
import cookieParser from 'cookie-parser' import path from "path";
import mainRouter from './routes/index.js' import cookieParser from "cookie-parser";
import mainRouter from "./routes/index.js";
const app = express() // 배포용?
const isProduction = process.env.NODE_ENV === "production";
let root_url = "/";
if (isProduction) {
root_url = "/app/todayku";
}
const CURRENT_WORKING_DIR = process.cwd();
app.use(express.json()) const app = express();
app.use(express.urlencoded({ extended: true }))
app.use(cookieParser())
app.use('/api', mainRouter)
export default app app.use(
\ No newline at end of file path.join(root_url, "/"),
express.static(path.join(CURRENT_WORKING_DIR, "client", "build"))
);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(path.join(root_url, "/api"), mainRouter);
export default app;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment