Skip to content

Commit 55b0ea0

Browse files
committed
feat: add environment variables support
1 parent b9872c1 commit 55b0ea0

File tree

5 files changed

+2288
-21238
lines changed

5 files changed

+2288
-21238
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
APP_NAME=
2+
APP_DESCRIPTION=
3+
APP_HOST=
4+
APP_PORT=
5+
APP_URL=
6+
API_URL=

api/repository.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ import { AxiosInstance } from 'axios'
1010
*
1111
* @return
1212
*/
13-
export default ($axios: AxiosInstance) => (resource: string): any => ({
14-
index(): any {
15-
return $axios.get(`${resource}`)
16-
},
13+
export default ($axios: AxiosInstance) =>
14+
(resource: string): any => ({
15+
index(): any {
16+
return $axios.get(`${resource}`)
17+
},
1718

18-
show(id: string): any {
19-
return $axios.get(`${resource}/${id}`)
20-
},
19+
show(id: string): any {
20+
return $axios.get(`${resource}/${id}`)
21+
},
2122

22-
create(payload: any): any {
23-
return $axios.post(`${resource}`, payload)
24-
},
23+
create(payload: any): any {
24+
return $axios.post(`${resource}`, payload)
25+
},
2526

26-
update(id: string, payload: any): any {
27-
return $axios.post(`${resource}/${id}`, payload)
28-
},
27+
update(id: string, payload: any): any {
28+
return $axios.post(`${resource}/${id}`, payload)
29+
},
2930

30-
delete(id: string): any {
31-
return $axios.delete(`${resource}/${id}`)
32-
},
33-
})
31+
delete(id: string): any {
32+
return $axios.delete(`${resource}/${id}`)
33+
},
34+
})

nuxt.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require('dotenv').config()
2+
13
const DEBUG = process.env.NODE_ENV !== 'production'
24

35
export default {
@@ -113,6 +115,7 @@ export default {
113115
'@nuxtjs/axios',
114116
'@nuxtjs/pwa',
115117
['vue-scrollto/nuxt', { duration: 1000 }],
118+
'@nuxtjs/dotenv',
116119
],
117120
/**
118121
* Public runtime configs

0 commit comments

Comments
 (0)