1
1
# Quasar Framework Generator
2
2
3
3
Create a Quasar Framework application using
4
- [ quasar-cli ] ( https://quasar.dev/quasar-cli/installation ) :
4
+ [ Quasar CLI ] ( https://quasar.dev/start/ quasar-cli ) :
5
5
6
6
``` console
7
- quasar create my-app
7
+ npm i -g @quasar/cli
8
+ npm init quasar
8
9
cd my-app
9
10
```
10
11
12
+ It will ask you some questions, you can use these answers:
13
+
14
+ ``` console
15
+ What would you like to build ? App with Quasar CLI, let's go!
16
+ Project folder: my-app
17
+ Pick Quasar version: Quasar v2 (Vue 3 | latest and greatest)
18
+ Pick script types: Typescript
19
+ Pick Quasar App CLI variant: Quasar App CLI with Vite
20
+ Package name: my-app
21
+ Pick a Vue component style: Composition API with <script setup>
22
+ Check the features needed for your project: ESLint / State Management (Pinia) / Vue-i18n
23
+ Pick an ESLint Preset: Prettier
24
+ ```
25
+
26
+ Install the required dependencies:
27
+
28
+ ``` console
29
+ npm install dayjs qs @types/qs
30
+ ```
31
+
11
32
In the app directory, generate the files for the resource you want:
12
33
13
34
``` console
14
35
npm init @api-platform/client https://demo.api-platform.com src/ -- --generator quasar --resource foo
15
36
```
16
37
17
38
Replace the URL by the entrypoint of your Hydra-enabled API.
18
- You can also use an OpenAPI documentation with ` -f openapi3 ` .
39
+ You can also use an OpenAPI documentation with ` https://demo.api-platform.com/docs.json ` and ` -f openapi3 ` .
19
40
20
41
Omit the resource flag to generate files for all resource types exposed by the API.
21
42
22
- The code is ready to be executed! Register the generated routes:
23
-
24
- ``` javascript
25
- // src/router/routes.js
26
- import fooRoutes from ' ../generated/router/foo' ;
27
-
28
- const routes = [
29
- {
30
- path: ' /' ,
31
- component : () => import (' layouts/MyLayout.vue' ),
32
- children: [
33
- ... fooRoutes
34
- ],
35
- ` ` `
43
+ ** Note:** Make sure to follow the result indications of the command to register the routes and the translations.
36
44
37
- And add the modules to the store :
45
+ Import common translations :
38
46
39
- ` ` ` javascript
40
- // src/store/index.js
41
- // Replace "foo" with the name of the resource type
42
- import foo from ' ../generated/store/modules/foo/' ;
47
+ ``` ts
48
+ // src/i18n/en-US/index.ts
49
+ import common from ' ./common' ;
43
50
44
- export default function (/* { ssrContext } */ ) {
45
- const Store = new Vuex.Store ({
46
- modules: {
47
- foo,
48
- },
51
+ export default {
52
+ // ...
53
+ ... common ,
54
+ }
49
55
```
50
56
51
57
Finally, make sure to update the config:
52
58
53
- ` ` ` javascript
59
+ ``` js
54
60
// quasar.conf.js
55
61
framework: {
56
- components: [
57
- ' QTable' ,
58
- ' QTh' ,
59
- ' QTr' ,
60
- ' QTd' ,
61
- ' QAjaxBar' ,
62
- ' QBreadcrumbs' ,
63
- ' QBreadcrumbsEl' ,
64
- ' QSpace' ,
65
- ' QInput' ,
66
- ' QForm' ,
67
- ' QSelect' ,
68
- ' QMarkupTable' ,
69
- ' QDate' ,
70
- ' QTime' ,
71
- ' QCheckbox' ,
72
- ' QPopupProxy'
73
-
74
- // ...
75
- ],
76
- directives: [... , ' ClosePopup' ],
77
62
plugins: [' Notify' ],
78
63
config: {
79
64
// ...
@@ -84,3 +69,13 @@ framework: {
84
69
},
85
70
},
86
71
` ` `
72
+
73
+ You can launch the server with:
74
+
75
+ ` ` ` console
76
+ quasar dev
77
+ ` ` `
78
+
79
+ Go to ` http: // localhost:9000/books/` to start using your app.
80
+
81
+ ** Note: ** In order to Mercure to work with the demo, you have to use the port 3000.
0 commit comments