1.0.0 • Published 3 years ago
dilvant-app-builder-api v1.0.0
Cambios, en la rama Break
El login tiene dos formator, UserSchema -> Profesionales, UserAppSchema - Buyers
Angular2 Updated to 2.1.0
MEA2N - ExpressJS, MongoDB, Gulp and Typescript (Repository Pattern)
##Introduction
Basic Angular seed application based on Quick start application (Tour of Heroes) given on angular website. It uses ExpressJS along with Mongo DB support (Mongoose) via a wrapper of Repository Pattern as Business layer. It also uses Gulp for running task and TsLint. It uses Pug and Sass to implement HTML templates and CSS styles as well. The seed application is built over node and uses latest node packages.
Prerequisites
- Latest version of Node to be installed.
- Install MongoDB and make sure it is running on default port 27017 (if not then please configure constants.ts and change the connection for mongoDB).
Steps to Run
npm install <= install all the npm Dependencies
npm run build <= build client and server application.
npm run start <= start the Nodemon and watch for changes.
Global packages
npm install ts-node -g
npm install typescript-node -g
Directory Structure
angular2-MEAN
├── node_modules
├── client
│ ├── app
│ │ ├── components
│ │ │ ├── dashboard
│ │ │ │ ├── dashboard.component.scss
│ │ │ │ ├── dashboard.component.pug
│ │ │ │ ├── dashboard.component.ts
│ │ │ ├── user-detail
│ │ │ │ ├── user-detail.component.scss
│ │ │ │ ├── user-detail.component.pug
│ │ │ │ ├── user-detail.component.ts
│ │ │ ├── users
│ │ │ │ ├── users.component.scss
│ │ │ │ ├── users.component.pug
│ │ │ │ ├── users.component.ts
│ │ ├── models
│ │ │ ├── user.ts
│ │ ├── services
│ │ │ ├── user.service.ts <= User Service for fetching api
│ │ ├── app.pug
│ │ ├── app.component.scss
│ │ ├── app.component.ts
│ │ ├── app.module.ts
│ │ ├── app.routing.ts
│ │ ├── main.ts
│ ├── index.pug
│ ├── systemjs.config.ts
│ ├── tsconfig.json
├── server
│ ├── app
│ │ ├── 0.crosswalk
│ │ │ ├── common
│ │ │ │ ├── interfaces
│ │ │ │ ├── utils
│ │ │ │ │ ├── Crypto.ts
│ │ │ │ │ ├── JWT.ts
│ │ │ │ │ ├── PlaceLookup.ts
│ │ │ │ │ ├── StringFormatter.ts
│ │ │ ├── config
│ │ │ │ ├── routes
│ │ │ │ │ ├── BaseRoutes.ts <= fetching all appliction routes here
│ │ │ │ │ ├── UserRoutes.ts <= User API Routes like get, post, put, delete
│ │ │ │ ├── sockets
│ │ │ │ ├── Constants.ts <= Constants - mongodb connection string and app environment.
│ │ │ │ ├── Express.ts <= Express - express configuration and initialization.
│ │ │ │ ├── Passport.ts
│ │ │ │ ├── Routing.ts <= Routing - routing initialization.
│ │ │ │ ├── Sockets.ts
│ │ ├── 1.controllers
│ │ │ ├── interfaces
│ │ │ | ├── common
│ │ │ | | ├── IBaseController.ts <= Base Repository controller
│ │ │ │ | ├── IReadController.ts
│ │ │ │ | ├── IWriteController.ts
│ │ │ ├── UserController.ts
│ │ ├── 2.models
│ │ │ ├── interfaces
│ │ │ │ ├── IUserModel.ts
│ │ │ ├── UserModel.ts
│ │ ├── 3.business <= business logic for application
│ │ │ ├── interfaces
│ │ │ | ├── common
│ │ │ | | ├── IBaseBusiness.ts
│ │ │ | │ ├── IReadBusiness.ts <= common Read method
│ │ │ | │ ├── IWriteBusiness.ts <= common Write method
│ │ │ │ ├── IUserBusiness.ts
│ │ │ ├── UserBusiness.ts
│ │ ├── 4.repositories
│ │ │ ├── interfaces
│ │ │ │ ├── IReadRepository.ts
│ │ │ │ ├── IWriteRepository.ts
│ │ │ ├── BaseRepository.ts
│ │ │ ├── UserRepository.ts
│ │ ├── 5.dataAccess
│ │ │ ├── schemas
│ │ │ │ ├── UserSchema.ts <= User Schema for MongoDB
│ │ │ ├── DataAccess.ts <= Connection with MongoDB
│ │ ├── server.ts
│ ├── tsconfig.json
├── gulpfile.ts <= gulp tasks: clean, build, compile, run.
├── LICENSE
├── package.json
├── Procfile
├── README.md
├── tsconfig.json
├── tslint.json
Features (Angular2, Express, Gulp, MongoDB, Node, Pug, Sass)
- Angular 2 Quick Start application based on (Tours of Heroes) from https://angular.io/docs/ts/latest/quickstart.html
- Added support for Gulp so that js files are moved out of the app folder.
- It will create a dist folder where it will place all the js files.
- Gulp will monitor for the changes via help of watcher.
- Created folder structure for easy access of components, services and models.
- Implemented Pug and Sass for HTML templates and CSS styles.
- Applied tslint for avoiding any typos.
- Implemented best practices recomended on the Angular 2 website.
- Implemented Express Server to Host API's
- Added MongoDB support to communicate our Users data to Database
- Implemented Repository Pattern to communicate with Mongoose.
Api Document (from MongoDB)
1. getAll http://localhost:3000/api/users <= get all users
1. getById http://localhost:3000/api/users/:id <= get user by Id
2. post http://localhost:3000/api/users <= create user
2. put http://localhost:3000/api/users/:id <= update user
2. delete http://localhost:3000/api/users/:id <= delete user
Dependencies
- Angular 2
- TypeScript
- Gulp
- ExpressJS
- NodeJS
- Nodemon
- TsLint
- MongoDB
- Pug
- Sass
License
MIT
1.0.0
3 years ago