-
Notifications
You must be signed in to change notification settings - Fork 8
/
params.json
6 lines (6 loc) · 6.14 KB
/
params.json
1
2
3
4
5
6
{
"name": "Ng2-forms-demo",
"tagline": "Angular2 - ng2 form using the MEAN2 / MEA2N stack. The form supports text fields and file uploading using jwt authentication. After submiting form, the file path is saved in MongoDB among the text fields.",
"body": "Angular 2 Form with file upload to file system, image path stored to Mongo. Project is built using the MEA2N/MEAN2 stack. This project could be used as an angular2-seed.\r\n\r\n[![NPM](https://nodei.co/npm/ng2-forms-demo.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/ng2-forms-demo/)\r\n\r\n## TODO\r\n1. Resize the image client-side in order to reduce bandwidth of the server.\r\n2. Edit users in admin area\r\n3. User Profile page\r\n\r\n# Angular 2 Form\r\n\r\nThis project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.21.\r\n\r\nThe goal of this project is to submit a form with one file upload and two text fields. The form is submitted to back end, the file is stored in the `uploadsFolder` and then the file path/url is stored in MongoDB among the two text fields. At the end, the form ID is assinged to the signed in user ID (via Ref) for later viewing all the form fields and file in the front end.\r\n\r\n##Prerequisites\r\n1. MongoDB installed and running (http://mongodb.org)\r\n2. Node.js and NPM installed (http://nodejs.org)\r\n3. [ImageMagick](http://www.imagemagick.org/script/index.php) or [GraphicsMagick](http://www.graphicsmagick.org/) installed,\r\nmore info in [gm](https://github.com/aheckmann/gm) page on how to install depending your Operating System. If installing ImageMagick on Windows, please check \"Install Legacy Utitities (e.g. convert\") during installation otherwise node will report errors.\r\n\r\n## Specs\r\n1. User login/signup using JSON Web Token (jwt)\r\n2. User password reset via email (nodemailer & SendGrid)\r\n3. Toastr Notifications (& Error Handling)\r\n4. Multipart form submission with image preview before upload (some of the upload logic is taken from primeng ui).\r\n5. Storing images to file system\r\n6. Storing image path to MongoDB among text fields\r\n7. Triple check if image is actually a file by checking it's mime type in both back end and in front end (`gm` in back end checks if file is an image too by reading first bytes of the file, need to fix this to not allow form to be submitted at all)\r\n8. Double check for the image size in both back end and front end, file limit now is 5.000.000 bytes (5MB)\r\n9. Image resize server side using [GraphicsMagick](https://github.com/aheckmann/gm)\r\n10. Form deletion among the file from filesystem, user forms array is updated too.\r\n11. Edit form, user can edit the text inputs and the image or update only the image or update only the text fields.\r\n12. Admin area, admin can edit or delete all forms in database\r\n\r\n## Packages Used\r\n`Angular-cli v1.0.0-beta.21` <br />\r\n`Angular v2.2.4` <br />\r\n`Webpack` <br />\r\n`Node v6.9.1` <br/>\r\n`MongoDB v3.2.10` <br/>\r\n`Mongoose v4.7.1` <br />\r\n`Express v4.14.0` <br />\r\n`angular2-jwt v0.1.25` (only for checking the expiration date of the jwt token and the user role (admin or user)) <br />\r\n`jsonwebtoken v7.1.9` <br />\r\n`Multer v1.2.0` <br />\r\n`ng2-toastr v1.3.2` <br />\r\n`ng2-progress-bar 0.0.5` <br />\r\n`gm v1.23.0` <br />\r\n`BootStrap 3` (css is included in `assets` folder) <br/>\r\n`Font Awesome` (css is included in `assets` folder) <br/>\r\n`Glyphicons` (found in `fonts` folder under `assets`) <br/>\r\n\r\n## Installing Dependecies\r\n1. Clone this repo from Git\r\n2. Run `npm install` in your command line.\r\n3. Edit `config.js` in `/server/config` folder.\r\n4. Run `node seed.js` to insert the admin user. Admin email is `[email protected]` and password is `testpass`. Make sure mongod is running.\r\n5. After login navigate to `localhost:3000/#/admin` to access admin panel.\r\n\r\n## Building the Angular2 app\r\nRun `ng build`\r\n\r\nA new `dist` folder will be created with all files needed to run the Angular 2 app in front end.\r\n\r\nIf you want to make changes on the Angular2 app and auto-refresh the `dist` folder then run the following command in your terminal:\r\n `ng build --watch`\r\n\r\n## Running the server\r\nRun `npm start` <br />\r\nIf you want to make changes on the Server and auto refresh the back end code then run: `nodemon npm start`. If you don't have nodemon installed, run `npm install nodemon -g`.\r\n\r\n## Viewing the App\r\nOpen your favourite web browser and point to `http://localhost:3000`\r\n\r\nEnjoy!\r\n\r\n## Help with angular-cli\r\nTo get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\r\n\r\n# Preview of the app\r\n### Login Form\r\n![Login Form](https://cloud.githubusercontent.com/assets/717975/20486222/8dddb670-b007-11e6-861a-18f2123f70f4.png)\r\n### Password Reset Form\r\n![forgot_password](https://cloud.githubusercontent.com/assets/717975/20642267/6a60daf0-b413-11e6-960d-2b12ec98a839.png)\r\n### Form\r\n![Form](https://cloud.githubusercontent.com/assets/717975/20486257/abfd4166-b007-11e6-8e2e-24d2afd746a0.png)\r\n### Server Response in console logs\r\n![Server response after submitting form](https://cloud.githubusercontent.com/assets/717975/20238428/053e95ec-a8f4-11e6-93ab-04258e359e13.png)\r\n### User Forms\r\n![form_table](https://cloud.githubusercontent.com/assets/717975/20667369/936c703a-b571-11e6-9e60-164d858c5793.png)\r\n### Edit Form\r\n![edit_form](https://cloud.githubusercontent.com/assets/717975/20598422/ce519cde-b251-11e6-919d-898855445f20.png)\r\n### Admin Page\r\n![admin_page](https://cloud.githubusercontent.com/assets/717975/20824439/80fa30da-b865-11e6-9af2-a7c6c2f1d7d3.png)\r\n### Users document in MongoDB with forms array ref\r\n![Users document in MongoDB](https://cloud.githubusercontent.com/assets/717975/20486315/eaa5b452-b007-11e6-9080-b1c8186bf404.png)\r\n### Forms Document in MongoDB with ref to the user._id (owner field)\r\n![User submitted forms page](https://cloud.githubusercontent.com/assets/717975/20486402/411bbf20-b008-11e6-9170-05f44d610cd8.png)\r\n",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}