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

front에서 이미지 요청 방법

parent 4949c01d
export default "/api"; export default "/api";
export const baseImageUrl = "http://localhost:3000/images";
export * as authApi from "./auth.api"; export * as authApi from "./auth.api";
export * as questionApi from "./question.api" export * as questionApi from "./question.api";
export * as surveyApi from "./survey.api" export * as surveyApi from "./survey.api";
export { baseImageUrl } from "./baseUrl";
import React, { useState } from "react"; import React, { useState } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { surveyApi } from "../apis"; import { baseImageUrl, surveyApi } from "../apis";
import { SurveyType } from "../types"; import { SurveyType } from "../types";
export const Profile = () => { export const Profile = () => {
...@@ -21,6 +21,7 @@ export const Profile = () => { ...@@ -21,6 +21,7 @@ export const Profile = () => {
return ( return (
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
<div className="m-5">나의 설문조사</div> <div className="m-5">나의 설문조사</div>
<img src={`${baseImageUrl}/9e24ad36a2947b08c89913b01`} />
<div className="flex space-x-4 mt-5"> <div className="flex space-x-4 mt-5">
<button <button
onClick={createSurvey} onClick={createSurvey}
......
import cookieParser from "cookie-parser"; import cookieParser from "cookie-parser";
import express, { Request, Response, NextFunction } from "express"; import express, { Request, Response, NextFunction } from "express";
import path from "path";
import router from "./routes"; import router from "./routes";
const app = express(); const app = express();
...@@ -8,6 +9,8 @@ app.use(express.json()); ...@@ -8,6 +9,8 @@ app.use(express.json());
app.use(express.urlencoded({ extended: true })); app.use(express.urlencoded({ extended: true }));
app.use(cookieParser()); app.use(cookieParser());
app.use("/images", express.static(path.join(__dirname, "..", "/uploads")));
app.use("/api", router); app.use("/api", router);
app.use((err: any, req: Request, res: Response, next: NextFunction) => { app.use((err: any, req: Request, res: Response, next: NextFunction) => {
......
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