1 | graoJS
|
2 | ======
|
3 |
|
4 | graoJS - A full stack MVC NodeJS framework
|
5 | ------------------------------------------
|
6 |
|
7 | This project is a scaffolding generator code, based on angularjs, twitter bootstrap, pug, express, mongoose and mongoose-validator.
|
8 |
|
9 | #### INSTALL DEPENDS
|
10 | - https://nodejs.org/en/download/package-manager/
|
11 | - https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
|
12 |
|
13 | #### graoJS install and run:
|
14 | ```
|
15 | sudo npm install -g graojs
|
16 | service mongodb start
|
17 | grao generate:app demo --name demo --description demo --author-name Marcelo --author-email marcelomf@gmail.com --server-ports 8015,8016 --template-engine pug --theme bootstrap --mongodb-host localhost --mongodb-db grao
|
18 | cd demo
|
19 | grao main:create:admin --username admin --name Admin --email admin@admin.localhost --password admin123
|
20 | node index.js
|
21 | ```
|
22 |
|
23 | #### Create your schemas
|
24 |
|
25 | - Create gen/Person.json
|
26 | ```json
|
27 | {
|
28 | "bundle": "cadastre",
|
29 | "label": "Persons",
|
30 | "description": "All people",
|
31 | "refLabel": "name",
|
32 | "fields": {
|
33 | "id": {
|
34 | "label": "Id",
|
35 | "type": "primary"
|
36 | },
|
37 | "name": {
|
38 | "label": "Name",
|
39 | "type": "text",
|
40 | "required": true,
|
41 | "isList": true,
|
42 | "isFilter": true
|
43 | },
|
44 | "email": {
|
45 | "label": "Email",
|
46 | "type": "email",
|
47 | "unique": true,
|
48 | "required": true,
|
49 | "isList": true,
|
50 | "isFilter": true
|
51 | },
|
52 | "born": {
|
53 | "label": "Born",
|
54 | "type": "date"
|
55 | },
|
56 | "sex": {
|
57 | "label": "Sex",
|
58 | "type": "radio",
|
59 | "options": { "marculine": "Masculine", "feminine": "Feminine" }
|
60 | },
|
61 | "news": {
|
62 | "label": "Receive newsletter ?",
|
63 | "type": "checkbox",
|
64 | "value": "IS_NEWS",
|
65 | "attr": {"multiple": true}
|
66 | },
|
67 | "address": [{
|
68 | "type": {
|
69 | "label": "Type",
|
70 | "type": "select",
|
71 | "options": { "residence": "Residence", "comercial": "comercial" },
|
72 | "required": "true"
|
73 | },
|
74 | "principal": {
|
75 | "label": "Principal",
|
76 | "type": "checkbox",
|
77 | "required": "true"
|
78 | },
|
79 | "address": {
|
80 | "label": "Address",
|
81 | "type": "textarea",
|
82 | "required": "true"
|
83 | }
|
84 | }]
|
85 | }
|
86 | }
|
87 | ```
|
88 | - Generate scaffolding(CRUD):
|
89 | ```
|
90 | grao generate:bundle --schemas Person --force
|
91 | ```
|
92 | - Start graojs:
|
93 | ```
|
94 | node index.js
|
95 | ```
|
96 | - Access Person in your browser:
|
97 | http://localhost:8015/admin/person
|
98 | - Others examples(with relashionships) of schemas:
|
99 | https://github.com/marcelomf/graojs/tree/master/gen_examples
|