├── .gitignore
├── README.md
├── backend
├── .prettierrc
├── README.md
├── nest-cli.json
├── nodemon-debug.json
├── nodemon.json
├── package-lock.json
├── package.json
├── src
│ ├── app.controller.spec.ts
│ ├── app.controller.ts
│ ├── app.module.ts
│ ├── app.service.ts
│ ├── contact.service.spec.ts
│ ├── contact.service.ts
│ ├── contacts
│ │ ├── contacts.controller.spec.ts
│ │ └── contacts.controller.ts
│ ├── entities
│ │ └── contact.entity.ts
│ ├── main.hmr.ts
│ └── main.ts
├── test
│ ├── app.e2e-spec.ts
│ └── jest-e2e.json
├── tsconfig.json
├── tsconfig.spec.json
├── tslint.json
└── webpack.config.js
└── frontend
├── .editorconfig
├── 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
│ ├── api.service.spec.ts
│ ├── api.service.ts
│ ├── app-routing.module.ts
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── contact.spec.ts
│ ├── contact.ts
│ └── contact
│ │ ├── contact.component.css
│ │ ├── contact.component.html
│ │ ├── contact.component.spec.ts
│ │ └── contact.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
├── tsconfig.json
└── tslint.json
/.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 | # profiling files
12 | chrome-profiler-events.json
13 | speed-measure-plugin.json
14 |
15 | # IDEs and editors
16 | /.idea
17 | .project
18 | .classpath
19 | .c9/
20 | *.launch
21 | .settings/
22 | *.sublime-workspace
23 |
24 | # IDE - VSCode
25 | .vscode/*
26 | !.vscode/settings.json
27 | !.vscode/tasks.json
28 | !.vscode/launch.json
29 | !.vscode/extensions.json
30 | .history/*
31 |
32 | # misc
33 | /.sass-cache
34 | /connect.lock
35 | /coverage
36 | /libpeerconnection.log
37 | npm-debug.log
38 | yarn-error.log
39 | testem.log
40 | /typings
41 |
42 | # System Files
43 | .DS_Store
44 | Thumbs.db
45 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nest.js Angular 7 CRUD RESTful API
2 | Nest.js, Angular 7 CRUD REST API
3 |
4 | 
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/backend/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "all"
4 | }
--------------------------------------------------------------------------------
/backend/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | [travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
6 | [travis-url]: https://travis-ci.org/nestjs/nest
7 | [linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
8 | [linux-url]: https://travis-ci.org/nestjs/nest
9 |
10 | A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
27 | ## Description
28 |
29 | [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
30 |
31 | ## Installation
32 |
33 | ```bash
34 | $ npm install
35 | ```
36 |
37 | ## Running the app
38 |
39 | ```bash
40 | # development
41 | $ npm run start
42 |
43 | # watch mode
44 | $ npm run start:dev
45 |
46 | # incremental rebuild (webpack)
47 | $ npm run webpack
48 | $ npm run start:hmr
49 |
50 | # production mode
51 | $ npm run start:prod
52 | ```
53 |
54 | ## Test
55 |
56 | ```bash
57 | # unit tests
58 | $ npm run test
59 |
60 | # e2e tests
61 | $ npm run test:e2e
62 |
63 | # test coverage
64 | $ npm run test:cov
65 | ```
66 |
67 | ## Support
68 |
69 | Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
70 |
71 | ## Stay in touch
72 |
73 | - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
74 | - Website - [https://nestjs.com](https://nestjs.com/)
75 | - Twitter - [@nestframework](https://twitter.com/nestframework)
76 |
77 | ## License
78 |
79 | Nest is [MIT licensed](LICENSE).
80 |
--------------------------------------------------------------------------------
/backend/nest-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "language": "ts",
3 | "collection": "@nestjs/schematics",
4 | "sourceRoot": "src"
5 | }
6 |
--------------------------------------------------------------------------------
/backend/nodemon-debug.json:
--------------------------------------------------------------------------------
1 | {
2 | "watch": ["src"],
3 | "ext": "ts",
4 | "ignore": ["src/**/*.spec.ts"],
5 | "exec": "node --inspect-brk -r ts-node/register src/main.ts"
6 | }
--------------------------------------------------------------------------------
/backend/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "watch": ["src"],
3 | "ext": "ts",
4 | "ignore": ["src/**/*.spec.ts"],
5 | "exec": "ts-node -r tsconfig-paths/register src/main.ts"
6 | }
7 |
--------------------------------------------------------------------------------
/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "0.0.0",
4 | "description": "description",
5 | "author": "",
6 | "license": "MIT",
7 | "scripts": {
8 | "format": "prettier --write \"src/**/*.ts\"",
9 | "start": "ts-node -r tsconfig-paths/register src/main.ts",
10 | "start:dev": "nodemon",
11 | "start:debug": "nodemon --config nodemon-debug.json",
12 | "prestart:prod": "rimraf dist && tsc",
13 | "start:prod": "node dist/main.js",
14 | "start:hmr": "node dist/server",
15 | "lint": "tslint -p tsconfig.json -c tslint.json",
16 | "test": "jest",
17 | "test:watch": "jest --watch",
18 | "test:cov": "jest --coverage",
19 | "test:e2e": "jest --config ./test/jest-e2e.json",
20 | "webpack": "webpack --config webpack.config.js"
21 | },
22 | "dependencies": {
23 | "@nestjs/common": "^5.1.0",
24 | "@nestjs/core": "^5.1.0",
25 | "@nestjs/typeorm": "^6.0.0",
26 | "mysql": "^2.16.0",
27 | "reflect-metadata": "^0.1.12",
28 | "rxjs": "^6.2.2",
29 | "typeorm": "^0.2.15",
30 | "typescript": "^3.0.1"
31 | },
32 | "devDependencies": {
33 | "@nestjs/testing": "^5.1.0",
34 | "@types/express": "^4.16.0",
35 | "@types/jest": "^23.3.1",
36 | "@types/node": "^10.7.1",
37 | "@types/supertest": "^2.0.5",
38 | "jest": "^23.5.0",
39 | "nodemon": "^1.18.3",
40 | "prettier": "^1.14.2",
41 | "rimraf": "^2.6.2",
42 | "supertest": "^3.1.0",
43 | "ts-jest": "^23.1.3",
44 | "ts-loader": "^4.4.2",
45 | "ts-node": "^7.0.1",
46 | "tsconfig-paths": "^3.5.0",
47 | "tslint": "5.11.0",
48 | "webpack": "^4.16.5",
49 | "webpack-cli": "^3.1.0",
50 | "webpack-node-externals": "^1.7.2"
51 | },
52 | "jest": {
53 | "moduleFileExtensions": [
54 | "js",
55 | "json",
56 | "ts"
57 | ],
58 | "rootDir": "src",
59 | "testRegex": ".spec.ts$",
60 | "transform": {
61 | "^.+\\.(t|j)s$": "ts-jest"
62 | },
63 | "coverageDirectory": "../coverage",
64 | "testEnvironment": "node"
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/backend/src/app.controller.spec.ts:
--------------------------------------------------------------------------------
1 | import { Test, TestingModule } from '@nestjs/testing';
2 | import { INestApplication } from '@nestjs/common';
3 | import { AppController } from './app.controller';
4 | import { AppService } from './app.service';
5 |
6 | describe('AppController', () => {
7 | let app: TestingModule;
8 |
9 | beforeAll(async () => {
10 | app = await Test.createTestingModule({
11 | controllers: [AppController],
12 | providers: [AppService],
13 | }).compile();
14 | });
15 |
16 | describe('root', () => {
17 | it('should return "Hello World!"', () => {
18 | const appController = app.get(AppController);
19 | expect(appController.root()).toBe('Hello World!');
20 | });
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/backend/src/app.controller.ts:
--------------------------------------------------------------------------------
1 | import { Get, Controller } from '@nestjs/common';
2 | import { AppService } from './app.service';
3 |
4 | @Controller()
5 | export class AppController {
6 | constructor(private readonly appService: AppService) {}
7 |
8 | @Get()
9 | root(): string {
10 | return this.appService.root();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/backend/src/app.module.ts:
--------------------------------------------------------------------------------
1 | import { Module } from '@nestjs/common';
2 | import { TypeOrmModule } from '@nestjs/typeorm';
3 | import { AppController } from './app.controller';
4 | import { AppService } from './app.service';
5 | import { Contact } from 'entities/contact.entity';
6 | import { ContactService } from './contact.service';
7 | import { ContactsController } from './contacts/contacts.controller';
8 |
9 |
10 | @Module({
11 | imports: [
12 | TypeOrmModule.forRoot({
13 | type: 'mysql',
14 | database: 'nestngdb',
15 | username: 'root',
16 | password: 'jb395566',
17 | entities: [__dirname + '/**/*.entity{.ts,.js}'],
18 | synchronize: true,
19 | }),
20 | TypeOrmModule.forFeature([Contact]),
21 | ],
22 | controllers: [AppController, ContactsController],
23 | providers: [AppService, ContactService],
24 | })
25 | export class AppModule { }
26 |
--------------------------------------------------------------------------------
/backend/src/app.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@nestjs/common';
2 |
3 | @Injectable()
4 | export class AppService {
5 | root(): string {
6 | return 'Hello World!';
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/backend/src/contact.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { Test, TestingModule } from '@nestjs/testing';
2 | import { ContactService } from './contact.service';
3 |
4 | describe('ContactService', () => {
5 | let service: ContactService;
6 | beforeAll(async () => {
7 | const module: TestingModule = await Test.createTestingModule({
8 | providers: [ContactService],
9 | }).compile();
10 | service = module.get(ContactService);
11 | });
12 | it('should be defined', () => {
13 | expect(service).toBeDefined();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/backend/src/contact.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@nestjs/common';
2 | import { Repository, UpdateResult, DeleteResult } from 'typeorm';
3 | import { InjectRepository } from '@nestjs/typeorm';
4 | import { Contact } from 'entities/contact.entity';
5 |
6 | @Injectable()
7 | export class ContactService {
8 | constructor(
9 | @InjectRepository(Contact)
10 | private contactRepository: Repository
11 | ) { }
12 | async create(contact: Contact): Promise {
13 | return await this.contactRepository.save(contact);
14 | }
15 |
16 | async readAll(): Promise {
17 | return await this.contactRepository.find();
18 | }
19 |
20 | async update(contact: Contact): Promise {
21 |
22 | return await this.contactRepository.update(contact.id,contact);
23 | }
24 |
25 | async delete(id): Promise {
26 | return await this.contactRepository.delete(id);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/backend/src/contacts/contacts.controller.spec.ts:
--------------------------------------------------------------------------------
1 | import { Test, TestingModule } from '@nestjs/testing';
2 | import { ContactsController } from './contacts.controller';
3 |
4 | describe('Contacts Controller', () => {
5 | let module: TestingModule;
6 | beforeAll(async () => {
7 | module = await Test.createTestingModule({
8 | controllers: [ContactsController],
9 | }).compile();
10 | });
11 | it('should be defined', () => {
12 | const controller: ContactsController = module.get(ContactsController);
13 | expect(controller).toBeDefined();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/backend/src/contacts/contacts.controller.ts:
--------------------------------------------------------------------------------
1 | import { Controller, Get, Post,Put, Delete, Body, Param } from '@nestjs/common';
2 | import { ContactService } from 'contact.service';
3 | import { Contact } from 'entities/contact.entity';
4 |
5 | @Controller('contacts')
6 | export class ContactsController {
7 |
8 | constructor(private contactService: ContactService){}
9 |
10 | @Get()
11 | read(): Promise {
12 | return this.contactService.readAll();
13 | }
14 |
15 | @Post('create')
16 | async create(@Body() contact: Contact): Promise {
17 | return this.contactService.create(contact);
18 | }
19 |
20 | @Put(':id/update')
21 | async update(@Param('id') id, @Body() contact: Contact): Promise {
22 | contact.id = Number(id);
23 | return this.contactService.update(contact);
24 | }
25 |
26 | @Delete(':id/delete')
27 | async delete(@Param('id') id): Promise {
28 | return this.contactService.delete(id);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/backend/src/entities/contact.entity.ts:
--------------------------------------------------------------------------------
1 | import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
2 | @Entity()
3 | export class Contact {
4 | @PrimaryGeneratedColumn()
5 | id: number;
6 |
7 | @Column()
8 | name: string;
9 |
10 | @Column()
11 | title: string;
12 |
13 | @Column()
14 | email: string;
15 |
16 | @Column()
17 | phone: string;
18 |
19 | @Column()
20 | address: string;
21 |
22 | @Column()
23 | city: string;
24 | }
--------------------------------------------------------------------------------
/backend/src/main.hmr.ts:
--------------------------------------------------------------------------------
1 | import { NestFactory } from '@nestjs/core';
2 | import { AppModule } from './app.module';
3 |
4 | declare const module: any;
5 |
6 | async function bootstrap() {
7 | const app = await NestFactory.create(AppModule);
8 | await app.listen(3000);
9 |
10 | if (module.hot) {
11 | module.hot.accept();
12 | module.hot.dispose(() => app.close());
13 | }
14 | }
15 | bootstrap();
16 |
--------------------------------------------------------------------------------
/backend/src/main.ts:
--------------------------------------------------------------------------------
1 | import { NestFactory } from '@nestjs/core';
2 | import { AppModule } from './app.module';
3 |
4 | async function bootstrap() {
5 | const app = await NestFactory.create(AppModule);
6 | app.enableCors();
7 | await app.listen(3000);
8 | }
9 | bootstrap();
10 |
--------------------------------------------------------------------------------
/backend/test/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { INestApplication } from '@nestjs/common';
2 | import { Test } from '@nestjs/testing';
3 | import * as request from 'supertest';
4 | import { AppModule } from './../src/app.module';
5 |
6 | describe('AppController (e2e)', () => {
7 | let app: INestApplication;
8 |
9 | beforeAll(async () => {
10 | const moduleFixture = await Test.createTestingModule({
11 | imports: [AppModule],
12 | }).compile();
13 |
14 | app = moduleFixture.createNestApplication();
15 | await app.init();
16 | });
17 |
18 | it('/ (GET)', () => {
19 | return request(app.getHttpServer())
20 | .get('/')
21 | .expect(200)
22 | .expect('Hello World!');
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/backend/test/jest-e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "moduleFileExtensions": ["js", "json", "ts"],
3 | "rootDir": ".",
4 | "testEnvironment": "node",
5 | "testRegex": ".e2e-spec.ts$",
6 | "transform": {
7 | "^.+\\.(t|j)s$": "ts-jest"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/backend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "declaration": true,
5 | "noImplicitAny": false,
6 | "removeComments": true,
7 | "noLib": false,
8 | "allowSyntheticDefaultImports": true,
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "target": "es6",
12 | "sourceMap": true,
13 | "outDir": "./dist",
14 | "baseUrl": "./src"
15 | },
16 | "include": [
17 | "src/**/*"
18 | ],
19 | "exclude": [
20 | "node_modules",
21 | "**/*.spec.ts"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/backend/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tsconfig.json",
3 | "compilerOptions": {
4 | "types": ["jest", "node"]
5 | },
6 | "include": ["**/*.spec.ts", "**/*.d.ts"]
7 | }
8 |
--------------------------------------------------------------------------------
/backend/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultSeverity": "error",
3 | "extends": [
4 | "tslint:recommended"
5 | ],
6 | "jsRules": {
7 | "no-unused-expression": true
8 | },
9 | "rules": {
10 | "eofline": false,
11 | "quotemark": [
12 | true,
13 | "single"
14 | ],
15 | "indent": false,
16 | "member-access": [
17 | false
18 | ],
19 | "ordered-imports": [
20 | false
21 | ],
22 | "max-line-length": [
23 | true,
24 | 150
25 | ],
26 | "member-ordering": [
27 | false
28 | ],
29 | "curly": false,
30 | "interface-name": [
31 | false
32 | ],
33 | "array-type": [
34 | false
35 | ],
36 | "no-empty-interface": false,
37 | "no-empty": false,
38 | "arrow-parens": false,
39 | "object-literal-sort-keys": false,
40 | "no-unused-expression": false,
41 | "max-classes-per-file": [
42 | false
43 | ],
44 | "variable-name": [
45 | false
46 | ],
47 | "one-line": [
48 | false
49 | ],
50 | "one-variable-per-declaration": [
51 | false
52 | ]
53 | },
54 | "rulesDirectory": []
55 | }
56 |
--------------------------------------------------------------------------------
/backend/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack');
2 | const path = require('path');
3 | const nodeExternals = require('webpack-node-externals');
4 |
5 | module.exports = {
6 | entry: ['webpack/hot/poll?1000', './src/main.hmr.ts'],
7 | watch: true,
8 | target: 'node',
9 | externals: [
10 | nodeExternals({
11 | whitelist: ['webpack/hot/poll?1000'],
12 | }),
13 | ],
14 | module: {
15 | rules: [
16 | {
17 | test: /\.tsx?$/,
18 | use: 'ts-loader',
19 | exclude: /node_modules/,
20 | },
21 | ],
22 | },
23 | mode: "development",
24 | resolve: {
25 | extensions: ['.tsx', '.ts', '.js'],
26 | },
27 | plugins: [
28 | new webpack.HotModuleReplacementPlugin(),
29 | ],
30 | output: {
31 | path: path.join(__dirname, 'dist'),
32 | filename: 'server.js',
33 | },
34 | };
35 |
--------------------------------------------------------------------------------
/frontend/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://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 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # Frontend
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.1.
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 |
--------------------------------------------------------------------------------
/frontend/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "frontend": {
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/frontend",
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 | "./node_modules/@angular/material/prebuilt-themes/purple-green.css",
27 | "src/styles.css"
28 | ],
29 | "scripts": [],
30 | "es5BrowserSupport": true
31 | },
32 | "configurations": {
33 | "production": {
34 | "fileReplacements": [
35 | {
36 | "replace": "src/environments/environment.ts",
37 | "with": "src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "optimization": true,
41 | "outputHashing": "all",
42 | "sourceMap": false,
43 | "extractCss": true,
44 | "namedChunks": false,
45 | "aot": true,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true,
49 | "budgets": [
50 | {
51 | "type": "initial",
52 | "maximumWarning": "2mb",
53 | "maximumError": "5mb"
54 | }
55 | ]
56 | }
57 | }
58 | },
59 | "serve": {
60 | "builder": "@angular-devkit/build-angular:dev-server",
61 | "options": {
62 | "browserTarget": "frontend:build"
63 | },
64 | "configurations": {
65 | "production": {
66 | "browserTarget": "frontend:build:production"
67 | }
68 | }
69 | },
70 | "extract-i18n": {
71 | "builder": "@angular-devkit/build-angular:extract-i18n",
72 | "options": {
73 | "browserTarget": "frontend:build"
74 | }
75 | },
76 | "test": {
77 | "builder": "@angular-devkit/build-angular:karma",
78 | "options": {
79 | "main": "src/test.ts",
80 | "polyfills": "src/polyfills.ts",
81 | "tsConfig": "src/tsconfig.spec.json",
82 | "karmaConfig": "src/karma.conf.js",
83 | "styles": [
84 | "./node_modules/@angular/material/prebuilt-themes/purple-green.css",
85 | "src/styles.css"
86 | ],
87 | "scripts": [],
88 | "assets": [
89 | "src/favicon.ico",
90 | "src/assets"
91 | ]
92 | }
93 | },
94 | "lint": {
95 | "builder": "@angular-devkit/build-angular:tslint",
96 | "options": {
97 | "tsConfig": [
98 | "src/tsconfig.app.json",
99 | "src/tsconfig.spec.json"
100 | ],
101 | "exclude": [
102 | "**/node_modules/**"
103 | ]
104 | }
105 | }
106 | }
107 | },
108 | "frontend-e2e": {
109 | "root": "e2e/",
110 | "projectType": "application",
111 | "prefix": "",
112 | "architect": {
113 | "e2e": {
114 | "builder": "@angular-devkit/build-angular:protractor",
115 | "options": {
116 | "protractorConfig": "e2e/protractor.conf.js",
117 | "devServerTarget": "frontend:serve"
118 | },
119 | "configurations": {
120 | "production": {
121 | "devServerTarget": "frontend:serve:production"
122 | }
123 | }
124 | },
125 | "lint": {
126 | "builder": "@angular-devkit/build-angular:tslint",
127 | "options": {
128 | "tsConfig": "e2e/tsconfig.e2e.json",
129 | "exclude": [
130 | "**/node_modules/**"
131 | ]
132 | }
133 | }
134 | }
135 | }
136 | },
137 | "defaultProject": "frontend"
138 | }
--------------------------------------------------------------------------------
/frontend/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 | };
--------------------------------------------------------------------------------
/frontend/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('Welcome to frontend!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | }));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/frontend/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/frontend/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 | }
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
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": "~7.2.0",
15 | "@angular/cdk": "~7.3.5",
16 | "@angular/common": "~7.2.0",
17 | "@angular/compiler": "~7.2.0",
18 | "@angular/core": "~7.2.0",
19 | "@angular/forms": "~7.2.0",
20 | "@angular/material": "^7.3.5",
21 | "@angular/platform-browser": "~7.2.0",
22 | "@angular/platform-browser-dynamic": "~7.2.0",
23 | "@angular/router": "~7.2.0",
24 | "core-js": "^2.5.4",
25 | "hammerjs": "^2.0.8",
26 | "rxjs": "~6.3.3",
27 | "tslib": "^1.9.0",
28 | "zone.js": "~0.8.26"
29 | },
30 | "devDependencies": {
31 | "@angular-devkit/build-angular": "~0.13.0",
32 | "@angular/cli": "~7.3.1",
33 | "@angular/compiler-cli": "~7.2.0",
34 | "@angular/language-service": "~7.2.0",
35 | "@types/node": "~8.9.4",
36 | "@types/jasmine": "~2.8.8",
37 | "@types/jasminewd2": "~2.0.3",
38 | "codelyzer": "~4.5.0",
39 | "jasmine-core": "~2.99.1",
40 | "jasmine-spec-reporter": "~4.2.1",
41 | "karma": "~3.1.1",
42 | "karma-chrome-launcher": "~2.2.0",
43 | "karma-coverage-istanbul-reporter": "~2.0.1",
44 | "karma-jasmine": "~1.1.2",
45 | "karma-jasmine-html-reporter": "^0.2.2",
46 | "protractor": "~5.4.0",
47 | "ts-node": "~7.0.0",
48 | "tslint": "~5.11.0",
49 | "typescript": "~3.2.2"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/frontend/src/app/api.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { ApiService } from './api.service';
4 |
5 | describe('ApiService', () => {
6 | beforeEach(() => TestBed.configureTestingModule({}));
7 |
8 | it('should be created', () => {
9 | const service: ApiService = TestBed.get(ApiService);
10 | expect(service).toBeTruthy();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/frontend/src/app/api.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { HttpClient } from '@angular/common/http';
3 | import { Contact } from './contact';
4 |
5 | @Injectable({
6 | providedIn: 'root'
7 | })
8 | export class ApiService {
9 |
10 | API_SERVER = "http://localhost:3000";
11 |
12 | constructor(private httpClient: HttpClient) { }
13 |
14 | public readContacts(){
15 | return this.httpClient.get(`${this.API_SERVER}/contacts`);
16 | }
17 |
18 | public createContact(contact: Contact){
19 | return this.httpClient.post(`${this.API_SERVER}/contacts/create`, contact);
20 | }
21 |
22 | public updateContact(contact: Contact){
23 | return this.httpClient.put(`${this.API_SERVER}/contacts/${contact.id}/update`, contact);
24 | }
25 |
26 | public deleteContact(id: number){
27 | return this.httpClient.delete(`${this.API_SERVER}/contacts/${id}/delete`);
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/frontend/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { ContactComponent } from './contact/contact.component';
4 |
5 | const routes: Routes = [
6 | {path: "", pathMatch: "full", redirectTo: "contacts"},
7 | {path: "contacts", component: ContactComponent}
8 | ];
9 |
10 | @NgModule({
11 | imports: [RouterModule.forRoot(routes)],
12 | exports: [RouterModule]
13 | })
14 | export class AppRoutingModule { }
15 |
--------------------------------------------------------------------------------
/frontend/src/app/app.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/nest-angular-crud/e4b742493756e5cdb4f8cbdf27da393ca03b2895/frontend/src/app/app.component.css
--------------------------------------------------------------------------------
/frontend/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Contact Management
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/frontend/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | }));
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.debugElement.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'frontend'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.debugElement.componentInstance;
26 | expect(app.title).toEqual('frontend');
27 | });
28 |
29 | it('should render title in a h1 tag', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.debugElement.nativeElement;
33 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to frontend!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/frontend/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 = 'frontend';
10 | }
11 |
--------------------------------------------------------------------------------
/frontend/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7 | import { HttpClientModule } from '@angular/common/http';
8 | import { FormsModule } from '@angular/forms';
9 | import { ContactComponent } from './contact/contact.component';
10 | import { MatInputModule, MatButtonModule, MatCardModule, MatFormFieldModule,MatTableModule } from '@angular/material';
11 |
12 | @NgModule({
13 | declarations: [
14 | AppComponent,
15 | ContactComponent
16 | ],
17 | imports: [
18 | BrowserModule,
19 | AppRoutingModule,
20 | BrowserAnimationsModule,
21 | HttpClientModule,
22 | FormsModule,
23 | MatTableModule,
24 | MatCardModule,
25 | MatInputModule,
26 | MatFormFieldModule,
27 | MatButtonModule
28 | ],
29 | providers: [],
30 | bootstrap: [AppComponent]
31 | })
32 | export class AppModule { }
33 |
--------------------------------------------------------------------------------
/frontend/src/app/contact.spec.ts:
--------------------------------------------------------------------------------
1 | import { Contact } from './contact';
2 |
3 | describe('Contact', () => {
4 | it('should create an instance', () => {
5 | expect(new Contact()).toBeTruthy();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/frontend/src/app/contact.ts:
--------------------------------------------------------------------------------
1 | export class Contact {
2 | id: number;
3 | name: string;
4 | title: string;
5 | email: string;
6 | phone: string;
7 | address: string;
8 | city: string;
9 | }
10 |
--------------------------------------------------------------------------------
/frontend/src/app/contact/contact.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/nest-angular-crud/e4b742493756e5cdb4f8cbdf27da393ca03b2895/frontend/src/app/contact/contact.component.css
--------------------------------------------------------------------------------
/frontend/src/app/contact/contact.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Contacts
4 |
5 |
6 |
7 |
8 | ID |
9 | {{element.id}} |
10 |
11 |
12 | Name |
13 | {{element.name}} |
14 |
15 |
16 | Title |
17 | {{element.title}} |
18 |
19 |
20 | Email |
21 | {{element.email}} |
22 |
23 |
24 | Phone |
25 | {{element.phone}} |
26 |
27 |
28 |
29 | Address |
30 | {{element.address}} |
31 |
32 |
33 |
34 | City |
35 | {{element.city}} |
36 |
37 |
38 |
39 | Actions |
40 |
41 |
42 |
43 |
44 | |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | Create a Contact
57 |
58 |
59 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/frontend/src/app/contact/contact.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ContactComponent } from './contact.component';
4 |
5 | describe('ContactComponent', () => {
6 | let component: ContactComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ContactComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ContactComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/frontend/src/app/contact/contact.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { ApiService } from '../api.service';
3 | import { Contact } from '../contact';
4 |
5 | @Component({
6 | selector: 'app-contact',
7 | templateUrl: './contact.component.html',
8 | styleUrls: ['./contact.component.css']
9 | })
10 | export class ContactComponent implements OnInit {
11 |
12 | displayedColumns : string[] = ['id', 'name', 'title', 'email', 'phone', 'address', 'city', 'actions'];
13 | dataSource = [];
14 | contact = {};
15 | constructor(private apiService: ApiService) { }
16 |
17 | ngOnInit() {
18 | this.apiService.readContacts().subscribe((result)=>{
19 | console.log(result);
20 | this.dataSource = result;
21 | })
22 | }
23 |
24 | selectContact(contact){
25 | this.contact = contact;
26 | console.log("selected: ", this.contact);
27 | }
28 |
29 | newContact(){
30 | this.contact = {};
31 | }
32 |
33 | createContact(f){
34 |
35 | console.log("form value: ", f.value);
36 |
37 | this.apiService.createContact(f.value).subscribe((result)=>{
38 | console.log(result);
39 | });
40 |
41 | }
42 |
43 | deleteContact(id){
44 | this.apiService.deleteContact(id).subscribe((result)=>{
45 | console.log(result);
46 | });
47 | }
48 |
49 | updateContact(f){
50 | console.log("Update", f.value)
51 | f.value.id = this.contact['id'];
52 | this.apiService.updateContact(f.value).subscribe((result)=>{
53 | console.log(result);
54 | });
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/frontend/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/nest-angular-crud/e4b742493756e5cdb4f8cbdf27da393ca03b2895/frontend/src/assets/.gitkeep
--------------------------------------------------------------------------------
/frontend/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 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/frontend/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/frontend/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 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/frontend/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/nest-angular-crud/e4b742493756e5cdb4f8cbdf27da393ca03b2895/frontend/src/favicon.ico
--------------------------------------------------------------------------------
/frontend/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Frontend
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/frontend/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/frontend'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
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 | };
32 |
--------------------------------------------------------------------------------
/frontend/src/main.ts:
--------------------------------------------------------------------------------
1 | import 'hammerjs';
2 | import { enableProdMode } from '@angular/core';
3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
4 |
5 | import { AppModule } from './app/app.module';
6 | import { environment } from './environments/environment';
7 |
8 | if (environment.production) {
9 | enableProdMode();
10 | }
11 |
12 | platformBrowserDynamic().bootstrapModule(AppModule)
13 | .catch(err => console.error(err));
14 |
--------------------------------------------------------------------------------
/frontend/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/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/frontend/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | html, body { height: 100%; }
4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
5 |
--------------------------------------------------------------------------------
/frontend/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 |
--------------------------------------------------------------------------------
/frontend/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/frontend/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/frontend/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 |
--------------------------------------------------------------------------------
/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "importHelpers": true,
13 | "target": "es5",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/frontend/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rulesDirectory": [
4 | "codelyzer"
5 | ],
6 | "rules": {
7 | "array-type": false,
8 | "arrow-parens": false,
9 | "deprecation": {
10 | "severity": "warn"
11 | },
12 | "import-blacklist": [
13 | true,
14 | "rxjs/Rx"
15 | ],
16 | "interface-name": false,
17 | "max-classes-per-file": false,
18 | "max-line-length": [
19 | true,
20 | 140
21 | ],
22 | "member-access": false,
23 | "member-ordering": [
24 | true,
25 | {
26 | "order": [
27 | "static-field",
28 | "instance-field",
29 | "static-method",
30 | "instance-method"
31 | ]
32 | }
33 | ],
34 | "no-consecutive-blank-lines": false,
35 | "no-console": [
36 | true,
37 | "debug",
38 | "info",
39 | "time",
40 | "timeEnd",
41 | "trace"
42 | ],
43 | "no-empty": false,
44 | "no-inferrable-types": [
45 | true,
46 | "ignore-params"
47 | ],
48 | "no-non-null-assertion": true,
49 | "no-redundant-jsdoc": true,
50 | "no-switch-case-fall-through": true,
51 | "no-use-before-declare": true,
52 | "no-var-requires": false,
53 | "object-literal-key-quotes": [
54 | true,
55 | "as-needed"
56 | ],
57 | "object-literal-sort-keys": false,
58 | "ordered-imports": false,
59 | "quotemark": [
60 | true,
61 | "single"
62 | ],
63 | "trailing-comma": false,
64 | "no-output-on-prefix": true,
65 | "use-input-property-decorator": true,
66 | "use-output-property-decorator": true,
67 | "use-host-property-decorator": true,
68 | "no-input-rename": true,
69 | "no-output-rename": true,
70 | "use-life-cycle-interface": true,
71 | "use-pipe-transform-interface": true,
72 | "component-class-suffix": true,
73 | "directive-class-suffix": true
74 | }
75 | }
76 |
--------------------------------------------------------------------------------