├── Angular6 ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── routes.ts │ │ ├── shared │ │ │ ├── user.model.ts │ │ │ ├── user.service.spec.ts │ │ │ └── user.service.ts │ │ └── user │ │ │ ├── sign-up │ │ │ ├── sign-up.component.css │ │ │ ├── sign-up.component.html │ │ │ ├── sign-up.component.spec.ts │ │ │ └── sign-up.component.ts │ │ │ ├── user.component.css │ │ │ ├── user.component.html │ │ │ ├── user.component.spec.ts │ │ │ └── user.component.ts │ ├── assets │ │ └── .gitkeep │ ├── browserslist │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── karma.conf.js │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ ├── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json ├── structure.txt ├── tsconfig.json └── tslint.json ├── README.md └── server ├── app.js ├── config ├── config.js └── config.json ├── controllers └── user.controller.js ├── models ├── db.js └── user.model.js ├── package-lock.json ├── package.json └── routes └── index.router.js /Angular6/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /Angular6/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /Angular6/README.md: -------------------------------------------------------------------------------- 1 | # Angular6 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To 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). 28 | -------------------------------------------------------------------------------- /Angular6/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "Angular6": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/Angular6", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "src/tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets" 24 | ], 25 | "styles": [ 26 | "src/styles.css" 27 | ], 28 | "scripts": [] 29 | }, 30 | "configurations": { 31 | "production": { 32 | "fileReplacements": [ 33 | { 34 | "replace": "src/environments/environment.ts", 35 | "with": "src/environments/environment.prod.ts" 36 | } 37 | ], 38 | "optimization": true, 39 | "outputHashing": "all", 40 | "sourceMap": false, 41 | "extractCss": true, 42 | "namedChunks": false, 43 | "aot": true, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true 47 | } 48 | } 49 | }, 50 | "serve": { 51 | "builder": "@angular-devkit/build-angular:dev-server", 52 | "options": { 53 | "browserTarget": "Angular6:build" 54 | }, 55 | "configurations": { 56 | "production": { 57 | "browserTarget": "Angular6:build:production" 58 | } 59 | } 60 | }, 61 | "extract-i18n": { 62 | "builder": "@angular-devkit/build-angular:extract-i18n", 63 | "options": { 64 | "browserTarget": "Angular6:build" 65 | } 66 | }, 67 | "test": { 68 | "builder": "@angular-devkit/build-angular:karma", 69 | "options": { 70 | "main": "src/test.ts", 71 | "polyfills": "src/polyfills.ts", 72 | "tsConfig": "src/tsconfig.spec.json", 73 | "karmaConfig": "src/karma.conf.js", 74 | "styles": [ 75 | "styles.css" 76 | ], 77 | "scripts": [], 78 | "assets": [ 79 | "src/favicon.ico", 80 | "src/assets" 81 | ] 82 | } 83 | }, 84 | "lint": { 85 | "builder": "@angular-devkit/build-angular:tslint", 86 | "options": { 87 | "tsConfig": [ 88 | "src/tsconfig.app.json", 89 | "src/tsconfig.spec.json" 90 | ], 91 | "exclude": [ 92 | "**/node_modules/**" 93 | ] 94 | } 95 | } 96 | } 97 | }, 98 | "Angular6-e2e": { 99 | "root": "e2e/", 100 | "projectType": "application", 101 | "architect": { 102 | "e2e": { 103 | "builder": "@angular-devkit/build-angular:protractor", 104 | "options": { 105 | "protractorConfig": "e2e/protractor.conf.js", 106 | "devServerTarget": "Angular6:serve" 107 | } 108 | }, 109 | "lint": { 110 | "builder": "@angular-devkit/build-angular:tslint", 111 | "options": { 112 | "tsConfig": "e2e/tsconfig.e2e.json", 113 | "exclude": [ 114 | "**/node_modules/**" 115 | ] 116 | } 117 | } 118 | } 119 | } 120 | }, 121 | "defaultProject": "Angular6" 122 | } -------------------------------------------------------------------------------- /Angular6/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /Angular6/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Angular6/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Angular6/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /Angular6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular6", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^6.0.0", 15 | "@angular/common": "^6.0.0", 16 | "@angular/compiler": "^6.0.0", 17 | "@angular/core": "^6.0.0", 18 | "@angular/forms": "^6.0.0", 19 | "@angular/http": "^6.0.0", 20 | "@angular/platform-browser": "^6.0.0", 21 | "@angular/platform-browser-dynamic": "^6.0.0", 22 | "@angular/router": "^6.0.0", 23 | "core-js": "^2.5.4", 24 | "rxjs": "^6.0.0", 25 | "zone.js": "^0.8.26" 26 | }, 27 | "devDependencies": { 28 | "@angular/compiler-cli": "^6.0.0", 29 | "@angular-devkit/build-angular": "~0.6.0", 30 | "typescript": "~2.7.2", 31 | "@angular/cli": "~6.0.0", 32 | "@angular/language-service": "^6.0.0", 33 | "@types/jasmine": "~2.8.6", 34 | "@types/jasminewd2": "~2.0.3", 35 | "@types/node": "~8.9.4", 36 | "codelyzer": "~4.2.1", 37 | "jasmine-core": "~2.99.1", 38 | "jasmine-spec-reporter": "~4.2.1", 39 | "karma": "~1.7.1", 40 | "karma-chrome-launcher": "~2.2.0", 41 | "karma-coverage-istanbul-reporter": "~1.4.2", 42 | "karma-jasmine": "~1.1.1", 43 | "karma-jasmine-html-reporter": "^0.2.2", 44 | "protractor": "~5.3.0", 45 | "ts-node": "~5.0.1", 46 | "tslint": "~5.9.1" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Angular6/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/MEAN-Stack-User-Registration-Front-End/cdd0c8a54729524e72f0c67406fad6abf2598a52/Angular6/src/app/app.component.css -------------------------------------------------------------------------------- /Angular6/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Angular6/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /Angular6/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /Angular6/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | // built-in 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { NgModule } from '@angular/core'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { RouterModule } from '@angular/router'; 6 | import { HttpClientModule } from '@angular/common/http'; 7 | // components 8 | import { AppComponent } from './app.component'; 9 | import { UserComponent } from './user/user.component'; 10 | import { SignUpComponent } from './user/sign-up/sign-up.component'; 11 | //routes 12 | import { appRoutes } from './routes'; 13 | 14 | @NgModule({ 15 | declarations: [ 16 | AppComponent, 17 | UserComponent, 18 | SignUpComponent 19 | ], 20 | imports: [ 21 | BrowserModule, 22 | FormsModule, 23 | RouterModule.forRoot(appRoutes), 24 | HttpClientModule 25 | ], 26 | providers: [], 27 | bootstrap: [AppComponent] 28 | }) 29 | export class AppModule { } 30 | -------------------------------------------------------------------------------- /Angular6/src/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { UserComponent } from './user/user.component'; 3 | import { SignUpComponent } from './user/sign-up/sign-up.component'; 4 | 5 | export const appRoutes: Routes = [ 6 | { 7 | path: 'signup', component: UserComponent, 8 | children: [{ path: '', component: SignUpComponent }] 9 | }, 10 | { 11 | path: '', redirectTo: '/signup', pathMatch: 'full' 12 | } 13 | ]; -------------------------------------------------------------------------------- /Angular6/src/app/shared/user.model.ts: -------------------------------------------------------------------------------- 1 | export class User { 2 | fullName: string; 3 | email: string; 4 | password: string; 5 | } -------------------------------------------------------------------------------- /Angular6/src/app/shared/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { UserService } from './user.service'; 4 | 5 | describe('UserService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [UserService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([UserService], (service: UserService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /Angular6/src/app/shared/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | 4 | import { environment } from '../../environments/environment'; 5 | import { User } from './user.model'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class UserService { 11 | selectedUser: User = { 12 | fullName: '', 13 | email: '', 14 | password: '' 15 | }; 16 | 17 | constructor(private http: HttpClient) { } 18 | 19 | postUser(user: User){ 20 | return this.http.post(environment.apiBaseUrl+'/register',user); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Angular6/src/app/user/sign-up/sign-up.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/MEAN-Stack-User-Registration-Front-End/cdd0c8a54729524e72f0c67406fad6abf2598a52/Angular6/src/app/user/sign-up/sign-up.component.css -------------------------------------------------------------------------------- /Angular6/src/app/user/sign-up/sign-up.component.html: -------------------------------------------------------------------------------- 1 |
2 | 4 |
5 | 6 |
7 | 9 |
10 | 11 | 12 |
13 | 15 |
16 | 17 | 18 |
19 | 20 |
21 | 22 | 23 |
24 | Saved successfully 25 |
26 | 27 | 28 |
29 | {{serverErrorMessages}} 30 |
-------------------------------------------------------------------------------- /Angular6/src/app/user/sign-up/sign-up.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SignUpComponent } from './sign-up.component'; 4 | 5 | describe('SignUpComponent', () => { 6 | let component: SignUpComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ SignUpComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SignUpComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /Angular6/src/app/user/sign-up/sign-up.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgForm } from '@angular/forms'; 3 | 4 | import { UserService } from '../../shared/user.service' 5 | 6 | @Component({ 7 | selector: 'app-sign-up', 8 | templateUrl: './sign-up.component.html', 9 | styleUrls: ['./sign-up.component.css'], 10 | providers: [UserService] 11 | }) 12 | export class SignUpComponent implements OnInit { 13 | emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 14 | showSucessMessage: boolean; 15 | serverErrorMessages: string; 16 | 17 | constructor(private userService: UserService) { } 18 | 19 | ngOnInit() { 20 | } 21 | 22 | onSubmit(form: NgForm) { 23 | this.userService.postUser(form.value).subscribe( 24 | res => { 25 | this.showSucessMessage = true; 26 | setTimeout(() => this.showSucessMessage = false, 4000); 27 | this.resetForm(form); 28 | }, 29 | err => { 30 | if (err.status === 422) { 31 | this.serverErrorMessages = err.error.join('
'); 32 | } 33 | else 34 | this.serverErrorMessages = 'Something went wrong.Please contact admin.'; 35 | } 36 | ); 37 | } 38 | 39 | resetForm(form: NgForm) { 40 | this.userService.selectedUser = { 41 | fullName: '', 42 | email: '', 43 | password: '' 44 | }; 45 | form.resetForm(); 46 | this.serverErrorMessages = ''; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Angular6/src/app/user/user.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/MEAN-Stack-User-Registration-Front-End/cdd0c8a54729524e72f0c67406fad6abf2598a52/Angular6/src/app/user/user.component.css -------------------------------------------------------------------------------- /Angular6/src/app/user/user.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Sign Up

4 | 5 |
6 |
-------------------------------------------------------------------------------- /Angular6/src/app/user/user.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UserComponent } from './user.component'; 4 | 5 | describe('UserComponent', () => { 6 | let component: UserComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ UserComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(UserComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /Angular6/src/app/user/user.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-user', 5 | templateUrl: './user.component.html', 6 | styleUrls: ['./user.component.css'] 7 | }) 8 | export class UserComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Angular6/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/MEAN-Stack-User-Registration-Front-End/cdd0c8a54729524e72f0c67406fad6abf2598a52/Angular6/src/assets/.gitkeep -------------------------------------------------------------------------------- /Angular6/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed 5 | > 0.5% 6 | last 2 versions 7 | Firefox ESR 8 | not dead 9 | # IE 9-11 -------------------------------------------------------------------------------- /Angular6/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /Angular6/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | apiBaseUrl: 'http://localhost:3000/api' 8 | }; 9 | 10 | /* 11 | * In development mode, to ignore zone related error stack frames such as 12 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can 13 | * import the following file, but please comment it out in production mode 14 | * because it will have performance impact when throw error 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /Angular6/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/MEAN-Stack-User-Registration-Front-End/cdd0c8a54729524e72f0c67406fad6abf2598a52/Angular6/src/favicon.ico -------------------------------------------------------------------------------- /Angular6/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular6 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Angular6/src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /Angular6/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /Angular6/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Web Animations `@angular/platform-browser/animations` 51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 53 | **/ 54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 55 | 56 | /** 57 | * By default, zone.js will patch all possible macroTask and DomEvents 58 | * user can disable parts of macroTask/DomEvents patch by setting following flags 59 | */ 60 | 61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 64 | 65 | /* 66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 68 | */ 69 | // (window as any).__Zone_enable_cross_context_check = true; 70 | 71 | /*************************************************************************************************** 72 | * Zone JS is required by default for Angular itself. 73 | */ 74 | import 'zone.js/dist/zone'; // Included with Angular CLI. 75 | 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /Angular6/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import url('https://fonts.googleapis.com/css?family=Poppins'); 3 | 4 | /* BASIC */ 5 | 6 | html { 7 | background-color: #56baed; 8 | } 9 | 10 | body { 11 | font-family: "Poppins", sans-serif; 12 | height: 100vh; 13 | } 14 | 15 | a { 16 | color: #92badd; 17 | display:inline-block; 18 | text-decoration: none; 19 | font-weight: 400; 20 | } 21 | 22 | h2 { 23 | text-align: center; 24 | font-size: 16px; 25 | font-weight: 600; 26 | text-transform: uppercase; 27 | display:inline-block; 28 | margin: 40px 8px 10px 8px; 29 | color: #cccccc; 30 | } 31 | 32 | 33 | 34 | /* STRUCTURE */ 35 | 36 | .wrapper { 37 | display: flex; 38 | align-items: center; 39 | flex-direction: column; 40 | justify-content: center; 41 | width: 100%; 42 | min-height: 100%; 43 | padding: 20px; 44 | } 45 | 46 | #formContent { 47 | -webkit-border-radius: 10px 10px 10px 10px; 48 | border-radius: 10px 10px 10px 10px; 49 | background: #fff; 50 | padding: 30px; 51 | width: 90%; 52 | max-width: 450px; 53 | position: relative; 54 | padding: 0px; 55 | -webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); 56 | box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); 57 | text-align: center; 58 | } 59 | 60 | #formFooter { 61 | background-color: #f6f6f6; 62 | border-top: 1px solid #dce8f1; 63 | padding: 25px; 64 | text-align: center; 65 | -webkit-border-radius: 0 0 10px 10px; 66 | border-radius: 0 0 10px 10px; 67 | } 68 | 69 | 70 | 71 | /* TABS */ 72 | 73 | h2.inactive { 74 | color: #cccccc; 75 | } 76 | 77 | h2.active { 78 | color: #0d0d0d; 79 | border-bottom: 2px solid #5fbae9; 80 | } 81 | 82 | 83 | 84 | /* FORM TYPOGRAPHY*/ 85 | 86 | input[type=button], input[type=submit], input[type=reset] { 87 | cursor: pointer; 88 | background-color: #56baed; 89 | border: none; 90 | color: white; 91 | padding: 15px 80px; 92 | text-align: center; 93 | text-decoration: none; 94 | display: inline-block; 95 | text-transform: uppercase; 96 | font-size: 13px; 97 | -webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4); 98 | box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4); 99 | -webkit-border-radius: 5px 5px 5px 5px; 100 | border-radius: 5px 5px 5px 5px; 101 | margin: 5px 20px 40px 20px; 102 | -webkit-transition: all 0.3s ease-in-out; 103 | -moz-transition: all 0.3s ease-in-out; 104 | -ms-transition: all 0.3s ease-in-out; 105 | -o-transition: all 0.3s ease-in-out; 106 | transition: all 0.3s ease-in-out; 107 | } 108 | 109 | input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover { 110 | background-color: #39ace7; 111 | } 112 | 113 | input[type=button]:active, input[type=submit]:active, input[type=reset]:active { 114 | -moz-transform: scale(0.95); 115 | -webkit-transform: scale(0.95); 116 | -o-transform: scale(0.95); 117 | -ms-transform: scale(0.95); 118 | transform: scale(0.95); 119 | } 120 | 121 | input[type=submit]:disabled{ 122 | background-color: #f5f6f6; 123 | color: #7d7d7d; 124 | } 125 | 126 | input[type=text],input[type=password] { 127 | background-color: #f6f6f6; 128 | border: none; 129 | color: #0d0d0d; 130 | padding: 15px 32px; 131 | text-align: center; 132 | text-decoration: none; 133 | display: inline-block; 134 | font-size: 16px; 135 | margin: 5px; 136 | width: 85%; 137 | border: 2px solid #f6f6f6; 138 | -webkit-transition: all 0.5s ease-in-out; 139 | -moz-transition: all 0.5s ease-in-out; 140 | -ms-transition: all 0.5s ease-in-out; 141 | -o-transition: all 0.5s ease-in-out; 142 | transition: all 0.5s ease-in-out; 143 | -webkit-border-radius: 5px 5px 5px 5px; 144 | border-radius: 5px 5px 5px 5px; 145 | } 146 | 147 | input[type=text]:focus,input[type=password]:focus { 148 | background-color: #fff; 149 | border-bottom: 2px solid #5fbae9; 150 | } 151 | 152 | input[type=text]:placeholder { 153 | color: #cccccc; 154 | } 155 | 156 | input[type=text].invalid-textbox,input[type=password].invalid-textbox{ 157 | border-bottom: 2px solid #ed5558; 158 | } 159 | 160 | label.validation-message{ 161 | color:#ed5558; 162 | } 163 | 164 | 165 | 166 | /* ANIMATIONS */ 167 | 168 | /* Simple CSS3 Fade-in-down Animation */ 169 | .fadeInDown { 170 | -webkit-animation-name: fadeInDown; 171 | animation-name: fadeInDown; 172 | -webkit-animation-duration: 1s; 173 | animation-duration: 1s; 174 | -webkit-animation-fill-mode: both; 175 | animation-fill-mode: both; 176 | } 177 | 178 | @-webkit-keyframes fadeInDown { 179 | 0% { 180 | opacity: 0; 181 | -webkit-transform: translate3d(0, -100%, 0); 182 | transform: translate3d(0, -100%, 0); 183 | } 184 | 100% { 185 | opacity: 1; 186 | -webkit-transform: none; 187 | transform: none; 188 | } 189 | } 190 | 191 | @keyframes fadeInDown { 192 | 0% { 193 | opacity: 0; 194 | -webkit-transform: translate3d(0, -100%, 0); 195 | transform: translate3d(0, -100%, 0); 196 | } 197 | 100% { 198 | opacity: 1; 199 | -webkit-transform: none; 200 | transform: none; 201 | } 202 | } 203 | 204 | /* Simple CSS3 Fade-in Animation */ 205 | @-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } 206 | @-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } 207 | @keyframes fadeIn { from { opacity:0; } to { opacity:1; } } 208 | 209 | .fadeIn { 210 | opacity:0; 211 | -webkit-animation:fadeIn ease-in 1; 212 | -moz-animation:fadeIn ease-in 1; 213 | animation:fadeIn ease-in 1; 214 | 215 | -webkit-animation-fill-mode:forwards; 216 | -moz-animation-fill-mode:forwards; 217 | animation-fill-mode:forwards; 218 | 219 | -webkit-animation-duration:1s; 220 | -moz-animation-duration:1s; 221 | animation-duration:1s; 222 | } 223 | 224 | .fadeIn.first { 225 | -webkit-animation-delay: 0.4s; 226 | -moz-animation-delay: 0.4s; 227 | animation-delay: 0.4s; 228 | } 229 | 230 | .fadeIn.second { 231 | -webkit-animation-delay: 0.6s; 232 | -moz-animation-delay: 0.6s; 233 | animation-delay: 0.6s; 234 | } 235 | 236 | .fadeIn.third { 237 | -webkit-animation-delay: 0.8s; 238 | -moz-animation-delay: 0.8s; 239 | animation-delay: 0.8s; 240 | } 241 | 242 | .fadeIn.fourth { 243 | -webkit-animation-delay: 1s; 244 | -moz-animation-delay: 1s; 245 | animation-delay: 1s; 246 | } 247 | 248 | /* Simple CSS3 Fade-in Animation */ 249 | .underlineHover:after { 250 | display: block; 251 | left: 0; 252 | bottom: -10px; 253 | width: 0; 254 | height: 2px; 255 | background-color: #56baed; 256 | content: ""; 257 | transition: width 0.2s; 258 | } 259 | 260 | .underlineHover:hover { 261 | color: #0d0d0d; 262 | } 263 | 264 | .underlineHover:hover:after{ 265 | width: 100%; 266 | } 267 | 268 | 269 | 270 | /* OTHERS */ 271 | 272 | *:focus { 273 | outline: none; 274 | } 275 | 276 | #icon { 277 | width:60%; 278 | } 279 | 280 | * { 281 | box-sizing: border-box; 282 | } 283 | 284 | 285 | .alert { 286 | padding: 20px; 287 | background-color: #f44336; /* Red */ 288 | color: white; 289 | margin-bottom: 15px; 290 | } 291 | 292 | .success{ 293 | padding: 20px; 294 | background-color:#249424; /* Green */ 295 | color: white; 296 | margin-bottom: 15px; 297 | } -------------------------------------------------------------------------------- /Angular6/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /Angular6/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "es2015", 6 | "types": [] 7 | }, 8 | "exclude": [ 9 | "src/test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /Angular6/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "module": "commonjs", 6 | "types": [ 7 | "jasmine", 8 | "node" 9 | ] 10 | }, 11 | "files": [ 12 | "test.ts", 13 | "polyfills.ts" 14 | ], 15 | "include": [ 16 | "**/*.spec.ts", 17 | "**/*.d.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Angular6/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Angular6/structure.txt: -------------------------------------------------------------------------------- 1 | ● src 2 | +---● app 3 | | +--● user 4 | | | |--user.component.ts|.html|.css 5 | | | +--● sign-up 6 | | | | |--sign-up.component.ts|.html|.css 7 | | | 8 | | |--● shared 9 | | | |--user.service.ts 10 | | | |--user.model.ts 11 | | | 12 | | |--app.module.ts 13 | | |--routes.ts 14 | | 15 | |--index.html -------------------------------------------------------------------------------- /Angular6/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "moduleResolution": "node", 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2017", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Angular6/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-use-before-declare": true, 76 | "no-var-keyword": true, 77 | "object-literal-sort-keys": false, 78 | "one-line": [ 79 | true, 80 | "check-open-brace", 81 | "check-catch", 82 | "check-else", 83 | "check-whitespace" 84 | ], 85 | "prefer-const": true, 86 | "quotemark": [ 87 | true, 88 | "single" 89 | ], 90 | "radix": true, 91 | "semicolon": [ 92 | true, 93 | "always" 94 | ], 95 | "triple-equals": [ 96 | true, 97 | "allow-null-check" 98 | ], 99 | "typedef-whitespace": [ 100 | true, 101 | { 102 | "call-signature": "nospace", 103 | "index-signature": "nospace", 104 | "parameter": "nospace", 105 | "property-declaration": "nospace", 106 | "variable-declaration": "nospace" 107 | } 108 | ], 109 | "unified-signatures": true, 110 | "variable-name": false, 111 | "whitespace": [ 112 | true, 113 | "check-branch", 114 | "check-decl", 115 | "check-operator", 116 | "check-separator", 117 | "check-type" 118 | ], 119 | "no-output-on-prefix": true, 120 | "use-input-property-decorator": true, 121 | "use-output-property-decorator": true, 122 | "use-host-property-decorator": true, 123 | "no-input-rename": true, 124 | "no-output-rename": true, 125 | "use-life-cycle-interface": true, 126 | "use-pipe-transform-interface": true, 127 | "component-class-suffix": true, 128 | "directive-class-suffix": true 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MEAN Stack User Registration Front End - Angular 6 2 | This is a MEAN Stack Demo Project to implement User Registration with password encryption and proper validation 3 | 4 | Content Discussed : 5 | - Design Registration Form Using Angular 6 6 | - Client-Side Validation 7 | - Node JS API Call From Angular 6 8 | 9 | ## Get the Code 10 | 11 | ``` 12 | $ git clone https://github.com/CodAffection/MEAN-Stack-User-Registration-Front-End.git 13 | $ cd MEAN-Stack-User-Registration-Front-End/Angular6 14 | $ npm install 15 | ``` 16 | 17 | ## How it works ? 18 | 19 | :scroll: Article on this topic 20 | Url : https://goo.gl/7w73sU 21 | 22 | :tv: Video tutorial on this same topic 23 | Url : https://goo.gl/xivk4x 24 | 25 | Video Tutorial for MEAN Stack User Registration Form in Angular 6 28 | 29 | 30 | ## Related MEAN Stack Tutorial in Order 31 | 1. CRUD Operation 32 | Insert Update View and Delete : https://goo.gl/LbQ4BM 33 | 2. User Registration
34 | Node JS Back End : https://goo.gl/CMnPwe
35 | Angular 6 Front End : https://goo.gl/xivk4x [_This One_] 36 | 3. JWT Authentication
37 | Node JS Back End : http://bit.ly/31FKEF6 38 | Angular Front End : http://bit.ly/2z6PmQ5 39 | 40 | 41 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 42 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 43 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 44 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 45 | | React |http://bit.ly/325temF | | 46 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 47 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 48 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 49 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 50 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 51 | | MEAN Stack |https://goo.gl/YJPPAH | | 52 | | C# Tutorial |https://goo.gl/s1zJxo | | 53 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 54 | | C# WinForm |https://goo.gl/vHS9Hd | | 55 | | MS SQL |https://goo.gl/MLYS9e | | 56 | | Crystal Report |https://goo.gl/5Vou7t | | 57 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 58 | 59 | -------------------------------------------------------------------------------- /server/app.js: -------------------------------------------------------------------------------- 1 | require('./config/config'); 2 | require('./models/db'); 3 | 4 | const express = require('express'); 5 | const bodyParser = require('body-parser'); 6 | const cors = require('cors'); 7 | 8 | const rtsIndex = require('./routes/index.router'); 9 | 10 | var app = express(); 11 | 12 | // middleware 13 | app.use(bodyParser.json()); 14 | app.use(cors()); 15 | app.use('/api', rtsIndex); 16 | 17 | // error handler 18 | app.use((err, req, res, next) => { 19 | if (err.name === 'ValidationError') { 20 | var valErrors = []; 21 | Object.keys(err.errors).forEach(key => valErrors.push(err.errors[key].message)); 22 | res.status(422).send(valErrors) 23 | } 24 | }); 25 | 26 | // start server 27 | app.listen(process.env.PORT, () => console.log(`Server started at port : ${process.env.PORT}`)); -------------------------------------------------------------------------------- /server/config/config.js: -------------------------------------------------------------------------------- 1 | // check env. 2 | var env = process.env.NODE_ENV || 'development'; 3 | // fetch env. config 4 | var config = require('./config.json'); 5 | var envConfig = config[env]; 6 | // add env. config values to process.env 7 | Object.keys(envConfig).forEach(key => process.env[key] = envConfig[key]); -------------------------------------------------------------------------------- /server/config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "development": { 3 | "PORT": 3000, 4 | "MONGODB_URI": "mongodb://localhost:27017/MEANStackDB" 5 | }, 6 | "production": { 7 | "PORT": 80, 8 | "MONGODB_URI": "mongodb://xxxxx/DB_Name" 9 | } 10 | } -------------------------------------------------------------------------------- /server/controllers/user.controller.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const User = mongoose.model('User'); 4 | 5 | module.exports.register = (req, res, next) => { 6 | var user = new User(); 7 | user.fullName = req.body.fullName; 8 | user.email = req.body.email; 9 | user.password = req.body.password; 10 | user.save((err, doc) => { 11 | if (!err) 12 | res.send(doc); 13 | else { 14 | if (err.code == 11000) 15 | res.status(422).send(['Duplicate email adrress found.']); 16 | else 17 | return next(err); 18 | } 19 | 20 | }); 21 | } -------------------------------------------------------------------------------- /server/models/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | mongoose.connect(process.env.MONGODB_URI, (err) => { 4 | if (!err) { console.log('MongoDB connection succeeded.'); } 5 | else { console.log('Error in MongoDB connection : ' + JSON.stringify(err, undefined, 2)); } 6 | }); 7 | 8 | require('./user.model'); -------------------------------------------------------------------------------- /server/models/user.model.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const bcrypt = require('bcryptjs'); 3 | 4 | var userSchema = new mongoose.Schema({ 5 | fullName: { 6 | type: String, 7 | required: 'Full name can\'t be empty' 8 | }, 9 | email: { 10 | type: String, 11 | required: 'Email can\'t be empty', 12 | unique: true 13 | }, 14 | password: { 15 | type: String, 16 | required: 'Password can\'t be empty', 17 | minlength : [4,'Password must be atleast 4 character long'] 18 | }, 19 | saltSecret: String 20 | }); 21 | 22 | // Custom validation for email 23 | userSchema.path('email').validate((val) => { 24 | emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 25 | return emailRegex.test(val); 26 | }, 'Invalid e-mail.'); 27 | 28 | // Events 29 | userSchema.pre('save', function (next) { 30 | bcrypt.genSalt(10, (err, salt) => { 31 | bcrypt.hash(this.password, salt, (err, hash) => { 32 | this.password = hash; 33 | this.saltSecret = salt; 34 | next(); 35 | }); 36 | }); 37 | }); 38 | 39 | mongoose.model('User', userSchema); -------------------------------------------------------------------------------- /server/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.5", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", 10 | "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", 11 | "requires": { 12 | "mime-types": "~2.1.18", 13 | "negotiator": "0.6.1" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "async": { 22 | "version": "2.1.4", 23 | "resolved": "https://registry.npmjs.org/async/-/async-2.1.4.tgz", 24 | "integrity": "sha1-LSFgx3iAMuTdbL4lAvH5osj2zeQ=", 25 | "requires": { 26 | "lodash": "^4.14.0" 27 | } 28 | }, 29 | "bcryptjs": { 30 | "version": "2.4.3", 31 | "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", 32 | "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" 33 | }, 34 | "bluebird": { 35 | "version": "3.5.0", 36 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", 37 | "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=" 38 | }, 39 | "body-parser": { 40 | "version": "1.18.3", 41 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", 42 | "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", 43 | "requires": { 44 | "bytes": "3.0.0", 45 | "content-type": "~1.0.4", 46 | "debug": "2.6.9", 47 | "depd": "~1.1.2", 48 | "http-errors": "~1.6.3", 49 | "iconv-lite": "0.4.23", 50 | "on-finished": "~2.3.0", 51 | "qs": "6.5.2", 52 | "raw-body": "2.3.3", 53 | "type-is": "~1.6.16" 54 | } 55 | }, 56 | "bson": { 57 | "version": "1.0.6", 58 | "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.6.tgz", 59 | "integrity": "sha512-D8zmlb46xfuK2gGvKmUjIklQEouN2nQ0LEHHeZ/NoHM2LDiMk2EYzZ5Ntw/Urk+bgMDosOZxaRzXxvhI5TcAVQ==" 60 | }, 61 | "bytes": { 62 | "version": "3.0.0", 63 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", 64 | "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" 65 | }, 66 | "content-disposition": { 67 | "version": "0.5.2", 68 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 69 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 70 | }, 71 | "content-type": { 72 | "version": "1.0.4", 73 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 74 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 75 | }, 76 | "cookie": { 77 | "version": "0.3.1", 78 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 79 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 80 | }, 81 | "cookie-signature": { 82 | "version": "1.0.6", 83 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 84 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 85 | }, 86 | "cors": { 87 | "version": "2.8.4", 88 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", 89 | "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", 90 | "requires": { 91 | "object-assign": "^4", 92 | "vary": "^1" 93 | } 94 | }, 95 | "debug": { 96 | "version": "2.6.9", 97 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 98 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 99 | "requires": { 100 | "ms": "2.0.0" 101 | } 102 | }, 103 | "depd": { 104 | "version": "1.1.2", 105 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 106 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 107 | }, 108 | "destroy": { 109 | "version": "1.0.4", 110 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 111 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 112 | }, 113 | "ee-first": { 114 | "version": "1.1.1", 115 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 116 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 117 | }, 118 | "encodeurl": { 119 | "version": "1.0.2", 120 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 121 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 122 | }, 123 | "escape-html": { 124 | "version": "1.0.3", 125 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 126 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 127 | }, 128 | "etag": { 129 | "version": "1.8.1", 130 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 131 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 132 | }, 133 | "express": { 134 | "version": "4.16.3", 135 | "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", 136 | "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", 137 | "requires": { 138 | "accepts": "~1.3.5", 139 | "array-flatten": "1.1.1", 140 | "body-parser": "1.18.2", 141 | "content-disposition": "0.5.2", 142 | "content-type": "~1.0.4", 143 | "cookie": "0.3.1", 144 | "cookie-signature": "1.0.6", 145 | "debug": "2.6.9", 146 | "depd": "~1.1.2", 147 | "encodeurl": "~1.0.2", 148 | "escape-html": "~1.0.3", 149 | "etag": "~1.8.1", 150 | "finalhandler": "1.1.1", 151 | "fresh": "0.5.2", 152 | "merge-descriptors": "1.0.1", 153 | "methods": "~1.1.2", 154 | "on-finished": "~2.3.0", 155 | "parseurl": "~1.3.2", 156 | "path-to-regexp": "0.1.7", 157 | "proxy-addr": "~2.0.3", 158 | "qs": "6.5.1", 159 | "range-parser": "~1.2.0", 160 | "safe-buffer": "5.1.1", 161 | "send": "0.16.2", 162 | "serve-static": "1.13.2", 163 | "setprototypeof": "1.1.0", 164 | "statuses": "~1.4.0", 165 | "type-is": "~1.6.16", 166 | "utils-merge": "1.0.1", 167 | "vary": "~1.1.2" 168 | }, 169 | "dependencies": { 170 | "body-parser": { 171 | "version": "1.18.2", 172 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", 173 | "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", 174 | "requires": { 175 | "bytes": "3.0.0", 176 | "content-type": "~1.0.4", 177 | "debug": "2.6.9", 178 | "depd": "~1.1.1", 179 | "http-errors": "~1.6.2", 180 | "iconv-lite": "0.4.19", 181 | "on-finished": "~2.3.0", 182 | "qs": "6.5.1", 183 | "raw-body": "2.3.2", 184 | "type-is": "~1.6.15" 185 | } 186 | }, 187 | "iconv-lite": { 188 | "version": "0.4.19", 189 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", 190 | "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" 191 | }, 192 | "qs": { 193 | "version": "6.5.1", 194 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", 195 | "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" 196 | }, 197 | "raw-body": { 198 | "version": "2.3.2", 199 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", 200 | "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", 201 | "requires": { 202 | "bytes": "3.0.0", 203 | "http-errors": "1.6.2", 204 | "iconv-lite": "0.4.19", 205 | "unpipe": "1.0.0" 206 | }, 207 | "dependencies": { 208 | "depd": { 209 | "version": "1.1.1", 210 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", 211 | "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" 212 | }, 213 | "http-errors": { 214 | "version": "1.6.2", 215 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", 216 | "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", 217 | "requires": { 218 | "depd": "1.1.1", 219 | "inherits": "2.0.3", 220 | "setprototypeof": "1.0.3", 221 | "statuses": ">= 1.3.1 < 2" 222 | } 223 | }, 224 | "setprototypeof": { 225 | "version": "1.0.3", 226 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", 227 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" 228 | } 229 | } 230 | }, 231 | "statuses": { 232 | "version": "1.4.0", 233 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 234 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 235 | } 236 | } 237 | }, 238 | "finalhandler": { 239 | "version": "1.1.1", 240 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", 241 | "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", 242 | "requires": { 243 | "debug": "2.6.9", 244 | "encodeurl": "~1.0.2", 245 | "escape-html": "~1.0.3", 246 | "on-finished": "~2.3.0", 247 | "parseurl": "~1.3.2", 248 | "statuses": "~1.4.0", 249 | "unpipe": "~1.0.0" 250 | }, 251 | "dependencies": { 252 | "statuses": { 253 | "version": "1.4.0", 254 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 255 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 256 | } 257 | } 258 | }, 259 | "forwarded": { 260 | "version": "0.1.2", 261 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 262 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 263 | }, 264 | "fresh": { 265 | "version": "0.5.2", 266 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 267 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 268 | }, 269 | "http-errors": { 270 | "version": "1.6.3", 271 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", 272 | "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", 273 | "requires": { 274 | "depd": "~1.1.2", 275 | "inherits": "2.0.3", 276 | "setprototypeof": "1.1.0", 277 | "statuses": ">= 1.4.0 < 2" 278 | } 279 | }, 280 | "iconv-lite": { 281 | "version": "0.4.23", 282 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", 283 | "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", 284 | "requires": { 285 | "safer-buffer": ">= 2.1.2 < 3" 286 | } 287 | }, 288 | "inherits": { 289 | "version": "2.0.3", 290 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 291 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 292 | }, 293 | "ipaddr.js": { 294 | "version": "1.6.0", 295 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", 296 | "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" 297 | }, 298 | "kareem": { 299 | "version": "2.1.0", 300 | "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.1.0.tgz", 301 | "integrity": "sha512-ycoMY1tVkcH1/NaxGn2erZaUC3CodmX7Fl6DUVXjN73+uecWYTaaldRkxNY3HeSKQnQTWnoxRKnZfVHcB8tIWg==" 302 | }, 303 | "lodash": { 304 | "version": "4.17.10", 305 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", 306 | "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" 307 | }, 308 | "lodash.get": { 309 | "version": "4.4.2", 310 | "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", 311 | "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" 312 | }, 313 | "media-typer": { 314 | "version": "0.3.0", 315 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 316 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 317 | }, 318 | "merge-descriptors": { 319 | "version": "1.0.1", 320 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 321 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 322 | }, 323 | "methods": { 324 | "version": "1.1.2", 325 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 326 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 327 | }, 328 | "mime": { 329 | "version": "1.4.1", 330 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", 331 | "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" 332 | }, 333 | "mime-db": { 334 | "version": "1.33.0", 335 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", 336 | "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" 337 | }, 338 | "mime-types": { 339 | "version": "2.1.18", 340 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", 341 | "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", 342 | "requires": { 343 | "mime-db": "~1.33.0" 344 | } 345 | }, 346 | "mongodb": { 347 | "version": "3.0.8", 348 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.0.8.tgz", 349 | "integrity": "sha512-mj7yIUyAr9xnO2ev8pcVJ9uX7gSum5LLs1qIFoWLxA5Il50+jcojKtaO1/TbexsScZ9Poz00Pc3b86GiSqJ7WA==", 350 | "requires": { 351 | "mongodb-core": "3.0.8" 352 | } 353 | }, 354 | "mongodb-core": { 355 | "version": "3.0.8", 356 | "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.0.8.tgz", 357 | "integrity": "sha512-dFxfhH9N7ohuQnINyIl6dqEF8sYOE0WKuymrFf3L3cipJNrx+S8rAbNOTwa00/fuJCjBMJNFsaA+R2N16//UIw==", 358 | "requires": { 359 | "bson": "~1.0.4", 360 | "require_optional": "^1.0.1" 361 | } 362 | }, 363 | "mongoose": { 364 | "version": "5.1.2", 365 | "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.1.2.tgz", 366 | "integrity": "sha512-k9hssPMgBnUYG5e9NoUbx/2ERDyelDY0Vf6BwjtmoETUhVT7pQUe1o+oelLLuHF3ZVY2qgienK8pnrI5pdvlxA==", 367 | "requires": { 368 | "async": "2.1.4", 369 | "bson": "~1.0.5", 370 | "kareem": "2.1.0", 371 | "lodash.get": "4.4.2", 372 | "mongodb": "3.0.8", 373 | "mongoose-legacy-pluralize": "1.0.2", 374 | "mpath": "0.4.1", 375 | "mquery": "3.0.0", 376 | "ms": "2.0.0", 377 | "regexp-clone": "0.0.1", 378 | "sliced": "1.0.1" 379 | } 380 | }, 381 | "mongoose-legacy-pluralize": { 382 | "version": "1.0.2", 383 | "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", 384 | "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" 385 | }, 386 | "mpath": { 387 | "version": "0.4.1", 388 | "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.4.1.tgz", 389 | "integrity": "sha512-NNY/MpBkALb9jJmjpBlIi6GRoLveLUM0pJzgbp9vY9F7IQEb/HREC/nxrixechcQwd1NevOhJnWWV8QQQRE+OA==" 390 | }, 391 | "mquery": { 392 | "version": "3.0.0", 393 | "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.0.0.tgz", 394 | "integrity": "sha512-WL1Lk8v4l8VFSSwN3yCzY9TXw+fKVYKn6f+w86TRzOLSE8k1yTgGaLBPUByJQi8VcLbOdnUneFV/y3Kv874pnQ==", 395 | "requires": { 396 | "bluebird": "3.5.0", 397 | "debug": "2.6.9", 398 | "regexp-clone": "0.0.1", 399 | "sliced": "0.0.5" 400 | }, 401 | "dependencies": { 402 | "sliced": { 403 | "version": "0.0.5", 404 | "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", 405 | "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=" 406 | } 407 | } 408 | }, 409 | "ms": { 410 | "version": "2.0.0", 411 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 412 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 413 | }, 414 | "negotiator": { 415 | "version": "0.6.1", 416 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 417 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 418 | }, 419 | "object-assign": { 420 | "version": "4.1.1", 421 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 422 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 423 | }, 424 | "on-finished": { 425 | "version": "2.3.0", 426 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 427 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 428 | "requires": { 429 | "ee-first": "1.1.1" 430 | } 431 | }, 432 | "parseurl": { 433 | "version": "1.3.2", 434 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", 435 | "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" 436 | }, 437 | "path-to-regexp": { 438 | "version": "0.1.7", 439 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 440 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 441 | }, 442 | "proxy-addr": { 443 | "version": "2.0.3", 444 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", 445 | "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", 446 | "requires": { 447 | "forwarded": "~0.1.2", 448 | "ipaddr.js": "1.6.0" 449 | } 450 | }, 451 | "qs": { 452 | "version": "6.5.2", 453 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 454 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 455 | }, 456 | "range-parser": { 457 | "version": "1.2.0", 458 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 459 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 460 | }, 461 | "raw-body": { 462 | "version": "2.3.3", 463 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", 464 | "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", 465 | "requires": { 466 | "bytes": "3.0.0", 467 | "http-errors": "1.6.3", 468 | "iconv-lite": "0.4.23", 469 | "unpipe": "1.0.0" 470 | } 471 | }, 472 | "regexp-clone": { 473 | "version": "0.0.1", 474 | "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", 475 | "integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" 476 | }, 477 | "require_optional": { 478 | "version": "1.0.1", 479 | "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", 480 | "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", 481 | "requires": { 482 | "resolve-from": "^2.0.0", 483 | "semver": "^5.1.0" 484 | } 485 | }, 486 | "resolve-from": { 487 | "version": "2.0.0", 488 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 489 | "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" 490 | }, 491 | "safe-buffer": { 492 | "version": "5.1.1", 493 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 494 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 495 | }, 496 | "safer-buffer": { 497 | "version": "2.1.2", 498 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 499 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 500 | }, 501 | "semver": { 502 | "version": "5.5.0", 503 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", 504 | "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" 505 | }, 506 | "send": { 507 | "version": "0.16.2", 508 | "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", 509 | "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", 510 | "requires": { 511 | "debug": "2.6.9", 512 | "depd": "~1.1.2", 513 | "destroy": "~1.0.4", 514 | "encodeurl": "~1.0.2", 515 | "escape-html": "~1.0.3", 516 | "etag": "~1.8.1", 517 | "fresh": "0.5.2", 518 | "http-errors": "~1.6.2", 519 | "mime": "1.4.1", 520 | "ms": "2.0.0", 521 | "on-finished": "~2.3.0", 522 | "range-parser": "~1.2.0", 523 | "statuses": "~1.4.0" 524 | }, 525 | "dependencies": { 526 | "statuses": { 527 | "version": "1.4.0", 528 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 529 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 530 | } 531 | } 532 | }, 533 | "serve-static": { 534 | "version": "1.13.2", 535 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", 536 | "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", 537 | "requires": { 538 | "encodeurl": "~1.0.2", 539 | "escape-html": "~1.0.3", 540 | "parseurl": "~1.3.2", 541 | "send": "0.16.2" 542 | } 543 | }, 544 | "setprototypeof": { 545 | "version": "1.1.0", 546 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", 547 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" 548 | }, 549 | "sliced": { 550 | "version": "1.0.1", 551 | "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", 552 | "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" 553 | }, 554 | "statuses": { 555 | "version": "1.5.0", 556 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 557 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 558 | }, 559 | "type-is": { 560 | "version": "1.6.16", 561 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", 562 | "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", 563 | "requires": { 564 | "media-typer": "0.3.0", 565 | "mime-types": "~2.1.18" 566 | } 567 | }, 568 | "unpipe": { 569 | "version": "1.0.0", 570 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 571 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 572 | }, 573 | "utils-merge": { 574 | "version": "1.0.1", 575 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 576 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 577 | }, 578 | "vary": { 579 | "version": "1.1.2", 580 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 581 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 582 | } 583 | } 584 | } 585 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "bcryptjs": "^2.4.3", 13 | "body-parser": "^1.18.3", 14 | "cors": "^2.8.4", 15 | "express": "^4.16.3", 16 | "mongoose": "^5.1.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/routes/index.router.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | const ctrlUser = require('../controllers/user.controller'); 5 | 6 | router.post('/register', ctrlUser.register); 7 | 8 | module.exports = router; 9 | 10 | 11 | 12 | --------------------------------------------------------------------------------