-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
221 lines (201 loc) · 5.79 KB
/
nuxt.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/* eslint-disable nuxt/no-cjs-in-config */
const routerBase =
process.env.DEPLOY_ENV === 'GH_PAGES'
? {
router: {
base: '/battle-cards/',
},
}
: {}
export default {
...routerBase,
// Global page headers: https://go.nuxtjs.dev/config-head
dev: process.env.NODE_ENV !== 'production',
telemetry: false,
publicRuntimeConfig: {
/** @type {import('io/types').NuxtSocketIoRuntimeOptions} */
io: {
sockets: [
{
name: 'publicSocket',
url: 'url1',
},
],
},
},
privateRuntimeConfig: {
/** @type {import('io/types').NuxtSocketIoRuntimeOptions} */
io: {
sockets: [
{
name: 'privateSocket',
url: 'url2',
},
],
},
},
env: {
MONGO_ALTA_USER: process.env.MONGO_ALTA_USER,
MONGO_ALTA_PWD: process.env.MONGO_ALTA_PWD,
SECRET_KEY: process.env.SECRET_KEY,
},
head: {
title: 'front',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' },
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
server: {
port: 3000, // default: 3000
host: '127.0.0.1', // default: localhost,
timing: false,
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ['element-ui/lib/theme-chalk/index.css'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: ['@/plugins/element-ui'],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
'@nuxtjs/eslint-module',
// 简单使用
'@nuxtjs/vuetify',
],
router: {
// middleware: ['auth']
},
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/bootstrap
'bootstrap-vue/nuxt',
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
// https://go.nuxtjs.dev/pwa
'@nuxtjs/pwa',
'@nuxtjs/auth-next',
'nuxt-socket-io',
],
/** @type {import('io/types').NuxtSocketIoOptions} */
io: {
// server: {
// cors: {
// origin: 'https://example.com',
// methods: ['GET', 'POST']
// }
// },
sockets: [
{
name: 'home',
url:
process.env.NODE_ENV === 'production'
? 'https://nuxt-socket-io.herokuapp.com'
: 'http://localhost:3000',
vuex: {
mutations: [{ progress: 'examples/SET_PROGRESS' }],
actions: [{ chatMessage: 'FORMAT_MESSAGE' }],
emitBacks: ['titleFromUser'],
},
namespaces: {
'/index': {
emitters: ['getMessage2 + testMsg --> message2Rxd'],
listeners: ['chatMessage2', 'chatMessage3 --> message3Rxd'],
},
},
},
{
name: 'chatSvc',
url:
process.env.NODE_ENV === 'production'
? 'https://nuxt-socket-io.herokuapp.com'
: 'http://localhost:3000',
// vuex: {
// mutations: [{ progress: 'examples/SET_PROGRESS' }],
// actions: [{ chatMessage: 'FORMAT_MESSAGE' }],
// emitBacks: [
// 'examples/someObj',
// 'examples/sample',
// { 'examples/sample2': 'sample2' },
// 'titleFromUser'
// ]
// },
// namespaces: {
// '/index': {
// emitters: ['getMessage2 + testMsg --> message2Rxd'],
// listeners: ['chatMessage2', 'chatMessage3 --> message3Rxd']
// },
// '/examples': {
// emitBacks: ['sample3', 'sample4 <-- myObj.sample4'],
// emitters: [
// 'reset] getProgress + refreshInfo --> progress [handleDone'
// ],
// listeners: ['progress']
// }
// }
},
{ name: 'goodSocket', url: 'http://localhost:3000' },
{ name: 'badSocket', url: 'http://localhost:3001' },
{ name: 'work', url: 'http://somedomain1:3000' },
{ name: 'car', url: 'http://somedomain2:3000' },
{ name: 'tv', url: 'http://somedomain3:3000' },
{
name: 'test',
url: 'http://localhost:4000',
vuex: {
mutations: [{ progress: 'examples/SET_PROGRESS' }],
actions: [{ chatMessage: 'FORMAT_MESSAGE' }],
emitBacks: ['examples/sample', { 'examples/sample2': 'sample2' }],
},
},
],
},
auth: {
strategies: {
local: {
token: {
property: 'token',
global: true,
required: true,
type: 'Bearer',
},
user: {
property: 'user',
autoFetch: true,
},
endpoints: {
login: { url: '/api/auth', method: 'post' },
// refresh: { url: "/api/auth/refresh-token", method: "post" },
logout: false, // we don't have an endpoint for our logout in our API and we just remove the token from localstorage
user: { url: '/api/user', method: 'get' },
},
},
},
},
target: process.env.NODE_ENV === 'production' ? 'static' : 'server',
// Axios module configuration: https://go.nuxtjs.dev/config-axios
// axios: { baseURL: 'http://www.perlinson.xyz:8080' },
axios: {
proxy: true,
},
proxy: {
'/api/': {
target:
process.env.NODE_ENV === 'production'
? 'http://www.perlinson.xyz:3000'
: 'http://localhost:3000',
},
},
// PWA module configuration: https://go.nuxtjs.dev/pwa
pwa: {
manifest: {
lang: 'en',
},
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},
}