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.
This project was generated with angular-cli version 1.0.0-beta.21.
The 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
uploads/forms/:userID and then the file name (string) 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. User profile image is stored at
gmin 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)
angular2-jwt v0.1.27 (only for checking the expiration date of the jwt token and the user role (admin or user))
BootStrap 3 (css is included in
Font Awesome (css is included in
Glyphicons (found in
fonts folder under
npm installin your command line.
node seed.jsto insert the admin user into database and create uploads folder. Admin email is
firstname.lastname@example.org password is
testpass. Make sure mongod is running.
localhost:3000/#/adminto access admin panel.
dist folder will be created with all files needed to run the Angular 2 app in front end.
If you want to make changes on the Angular2 app and auto-refresh the
dist folder then run the following command in your terminal:
ng build --watch
If 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.
Open your favourite web browser and point to
To get more help on the
ng --help or go check out the Angular-CLI README.
### Password Reset Form ### Form ### Server Response in console logs ### User Forms ### Edit Form ### Admin Page ### Profile Page ### Users document in MongoDB with forms array ref ### Forms Document in MongoDB with ref to the user._id (owner field)