generator-crudangnode
v0.0.1
Published
A generator that takes a Datamodel in a JSON file and generates an Angular Frontend and Node.js Backend with CRUD functionality
Downloads
2
Readme
generator-crudangnode
A generator that takes a Datamodel in a JSON file and generates an Angular Frontend and Node.js Backend with CRUD functionality
Installation
- Install Yeoman by running
npm install -g yo
. - Install generator-crudangnode by running
npm install -g generator-crudangnode
. - Generate a new project by running
yo crudangnode
.
MongoDB Cloud
- The generator uses the cloud version of MongoDB (https://cloud.mongodb.com).
- Create a MongoDB cloud account. Store the MongoDB URI in the configuration file.
- You can also use the DB_USER and DB_PASS environment variables where you store the credentials for more security. These are read in the code and stored as mongo_username and mongo_password. In the URI, these variables can be used afterwards, as you can see in the following JSON configuration example.
Config Format
- You can start without an existing configuration file. In the generator prompt select "no configuration file" and create one in the following dialogs.
- For table names, use the singular and plural forms, separated by a slash.
- Type options: "string", "number", "boolean".
- You can use references by writing the plural form of the table, followed by a dot, and the name of the attribute.
- Options and radio buttons are supported for the dialog. For details, see the JSON file.
- Date selection is also supported for the dialog. Select from: "date": "basic", "date": "rangeBegin", "date": "rangeEnd". If you use the range date selection, you must assign an attribute with "date": "rangeBegin" and an attribute with "date": "rangeEnd".
{
"tables": {
"Antrag/Antraege": {
"Mitarbeiter": {
"type": "string",
"require": "true",
"reference": "Mitarbeiter.Name"
},
"Tage": {
"type": "number",
"require": "true"
},
"Geschlecht": {
"type": "number",
"require": "true",
"radio": {
"radio1": "weiblich",
"radio2": "männlich",
"radio3": "divers"
}
}
},
"Mitarbeiter/Mitarbeiter": {
"Name": {
"type": "string",
"require": "true"
},
"Wohnort": {
"type": "string",
"require": "true",
"option": {
"option1": "Paderborn",
"option2": "Bielefeld"
}
}
}
},
"mongodbURI": "`mongodb+srv://${mongo_username}:${mongo_password}@cluster0.jvjd1n7.mongodb.net/?retryWrites=true&w=majority`",
"database": "database100"
}
Yeoman-UI
- Yeoman-Ui provides a comprehensive user experience for Yeoman generators, eliminating the need to communicate via the command line.
- You can use the VSCode extension or the browser. (https://github.com/SAP/yeoman-ui)
Start Client And Server After Generation
- Navigate to the server folder and run "node index.js" to start the server.
- Launch another window and navigate to the client folder. Run 'npm start' to start the client. By default, the following address is used: http://localhost:4200/.
Getting To Know Yeoman
- Feel free to learn more about Yeoman.
License
MIT © Johannes Kaiser