-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
53 lines (42 loc) · 1.34 KB
/
app.js
File metadata and controls
53 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// express 가져오기
const express = require('express');
const app = express();
var swaggerJsdoc = require("swagger-jsdoc");
var swaggerUi = require("swagger-ui-express");
const cors = require('cors');
const path = require('path');
const multerMiddleware = require('./multer/multer.js');
const options = {
definition: {
openapi: "3.0.0",
info: {
title: "LogRocket Express API with Swagger",
version: "0.1.0",
description:
"This is a simple CRUD API application made with Express and documented with Swagger",
},
servers: [
{
url: "https://ao-rztme.run.goorm.site/",
},
],
},
apis: ["./Router/*.js"],
};
//const { swaggerUi, specs } = require("./swagger/swagger")
const router = express.Router();
app.use(express.json());
app.use(multerMiddleware);
app.use('/images', express.static(path.join(__dirname, 'images')));
require('dotenv').config();
const port = process.env.PORT;
// 모든 CORS 허용 -> 보안상 안좋대
app.use(cors());
const specs = swaggerJsdoc(options);
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(specs));
app.use('/user', require('./Router/userRouter.js'));
app.use('/funding', require('./Router/fundingRouter.js'));
app.get('/', (req, res) => {
res.send('하이');
});
app.listen(port, () => { console.log('Server is running on port', port); });