-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
62 lines (48 loc) · 1.81 KB
/
server.js
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
54
55
56
57
58
59
60
61
62
import express from 'express';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
const PORT = 3000;
// 정적 파일 제공
app.use(express.static(path.join(__dirname, 'public')));
// 기본 경로 설정
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'Log in.html'));
});
// HTML 파일 응답
app.get('/public/page/edit-password', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'edit password.html'));
});
app.get('/public/page/edit-post', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'edit post.html'));
});
app.get('/public/page/edit-profile', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'edit profile.html'));
});
app.get('/public/page/login', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'Log in.html'));
});
app.get('/public/page/make-post', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'make post.html'));
});
app.get('/public/page/post', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'post.html'));
});
app.get('/public/page/Posts.html', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'Posts.html'));
});
app.get('/public/page/Sign in.html', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'Sign in.html'));
});
app.get('/public/page/Log in.html', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'page', 'Log in.html'));
});
// 서버 시작
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server is running on ${PORT}`);
});
// app.listen(PORT, () => {
// console.log(`Server is running on http://localhost:${PORT}`);
// });