-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
124 lines (117 loc) · 3.95 KB
/
next.config.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
const { withContentlayer } = require("next-contentlayer");
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
const LOCAL_BASE_URL = process.env.NEXT_PUBLIC_LOCAL_BASE_URL;
const API_KEY = process.env.API_KEY;
module.exports = withContentlayer({
pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],
experimental: {
mdxRs: true,
},
reactStrictMode: true,
swcMinify: true,
env: {
redisUrl: '${process.env.UPSTASH_REDIS_REST_URL}',
redisToken: '${process.env.UPSTASH_REDIS_REST_TOKEN}',
baseUrl: '${process.env.BASE_URL}',
localBaseUrl: '${process.env.LOCAL_BASE_URL}',
},
images: {
domains: ['lh3.googleusercontent.com','avatars.githubusercontent.com'],
},
async redirects() {
return [
// Blog Login 관련
{
source: '/auth/login/google',
destination: BASE_URL+`/login/oauth2/authorization/google`,
permanent: false,
},
{
source: '/auth/login/github',
destination: BASE_URL+`/login/oauth2/authorization/github`,
permanent: false,
},
{
source: '/auth/login/google',
has: [
{
type: 'query',
key: 'prevPage',
value: '(?<prevPage>.*)',
}
],
destination: BASE_URL+`/login/oauth2/authorization/google?prevPage=:prevPage`,
permanent: false,
},
{
source: '/auth/login/github',
has: [
{
type: 'query',
key: 'prevPage',
value: '(?<prevPage>.*)',
}
],
destination: BASE_URL+`/login/oauth2/authorization/github?prevPage=:prevPage`,
permanent: false,
},
]
},
async rewrites() {
return [
// Blog API 관련
{
source: '/api/blog/comment',
has: [
{
type: 'query',
key: 'slug',
value: '(?<slug>.*)',
},
{
type: 'query',
key: 'page',
value: '(?<page>.*)',
}
],
destination: BASE_URL+`/comment?slug=:slug&page=:page`
},
{
source: '/api/blog/comment/post/:userId',
destination: BASE_URL+`/comment?userId=:userId`
},
{
source: '/api/blog/comment/delete/:commentId/:userId',
destination: BASE_URL+`/comment?commentId=:commentId&userId=:userId`
},
// Blog Comment Reply
{
source: '/api/blog/comment/:commentId',
has: [
{
type: 'query',
key: 'page',
value: '(?<page>.*)',
}
],
destination: BASE_URL+`/comment/:commentId?page=:page`
},
{
source: '/api/blog/comment/:commentId/:userId',
destination: BASE_URL+`/comment/:commentId?userId=:userId`
},
{
source: '/api/blog/comment/:commentId/:commentReplyId/:userId',
destination: BASE_URL+`/comment/:commentId?commentReplyId=:commentReplyId&userId=:userId`
},
{
source: '/api/blog/user',
destination: BASE_URL+`/user`
},
{
source: '/api/blog/auth/refresh',
destination: BASE_URL+`/auth/refresh`
},
]
}
});