sails-generate-forestay
Version:
Build dynamic user interfaces quickly and easily! Use the forestay generator to scaffold complete CRUD interfaces using just your SailsJS model attributes.
106 lines (81 loc) • 2.22 kB
Markdown
https://nodejs.org/en/download/
```bash
npm install sails -g
```
We recommend using an "Empty" project, but you can use "Webapp", too
```bash
sails new projectmanage
```
```bash
npm install sails generate forestay
```
```bash
sails generate forestay user
sails generate forestay usergroup
sails generate forestay project
```
Your models are located at `api/models` and can be modified with Forestay features.
```bash
node app.js
```
Navigate around. You'll quickly realize that there's nothing there.
```javascript
attributes: {
name: {
type: "string",
required: true
},
email: {
type: "string",
required: true
},
}
```
These attributes will now appear when you add new users when you go to `/user/create`
```javascript
attributes: {
name: {
type: "string",
description: "The project name",
required: true
},
}
```
```Javascript
attributes: {
name: {
type: "string",
description: "The project name",
required: true
},
}
```
```javascript
userGroups: {
model:"Usergroup",
meta: {
forestay: {
populateBy: "name", // This is the attribute value that it uses to populate your UI
filterable: true, // you will now be able to filter users by usergroups
label: "User Group", // This is what label will be shown to the user
description: "The user group this user is assigned to", // This will display as a help description on create/update
}
}
},
```
Now navigate to /userGroup/ and create a couple user groups like "Admin" or "Project Manager"
You can now associate users to usergroups by creating new users.