├── officeapi ├── src │ ├── assets │ │ ├── .gitkeep │ │ ├── 1.-mike-office.png │ │ ├── 2.-jim-and-pam.png │ │ ├── favicon-16x16.png │ │ ├── officeApiLogo.png │ │ ├── OfficeApiFavicon.png │ │ ├── 4.-office-building.png │ │ └── 2.-meeting-room,-prison-mike.png │ ├── app │ │ ├── components │ │ │ └── homepage │ │ │ │ ├── homepage.component.scss │ │ │ │ ├── homepage.component.html │ │ │ │ ├── homepage.component.ts │ │ │ │ └── homepage.component.spec.ts │ │ ├── angular-prism │ │ │ ├── dist │ │ │ │ ├── angular-prism.d.ts │ │ │ │ ├── angular-prism.js.map │ │ │ │ ├── angular-prism.js │ │ │ │ └── src │ │ │ │ │ ├── prism.component.d.ts │ │ │ │ │ ├── prism.component.js.map │ │ │ │ │ └── prism.component.js │ │ │ ├── angular-prism.ts │ │ │ └── src │ │ │ │ └── prism.component.ts │ │ ├── app-routing.module.ts │ │ ├── services │ │ │ ├── api.service.ts │ │ │ └── api.service.spec.ts │ │ ├── app.module.ts │ │ ├── app.component.ts │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ └── app.component.html │ ├── favicon.ico │ ├── fonts │ │ ├── Typist.ttf │ │ └── AmericanTypewriterRegular.ttf │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── browserconfig.xml │ ├── variables.scss │ ├── index.html │ ├── styles.scss │ ├── main.ts │ ├── test.ts │ ├── polyfills.ts │ └── codeblock.scss ├── .idea │ ├── codeStyles │ │ ├── codeStyleConfig.xml │ │ └── Project.xml │ ├── misc.xml │ ├── vcs.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── modules.xml │ └── officeapi.iml ├── e2e │ ├── tsconfig.json │ ├── src │ │ ├── app.po.ts │ │ └── app.e2e-spec.ts │ └── protractor.conf.js ├── tsconfig.app.json ├── .editorconfig ├── tsconfig.spec.json ├── browserslist ├── tsconfig.json ├── .gitignore ├── README.md ├── karma.conf.js ├── package.json ├── tslint.json └── angular.json ├── .gitignore ├── README.md ├── public ├── favicon.ico ├── assets │ ├── 1.-mike-office.png │ ├── 2.-jim-and-pam.png │ ├── favicon-16x16.png │ ├── officeApiLogo.png │ ├── OfficeApiFavicon.png │ ├── 4.-office-building.png │ └── 2.-meeting-room,-prison-mike.png ├── Typist.733f9a18362faa2cdd69.ttf ├── AmericanTypewriterRegular.940ace70d6c766e685a2.ttf ├── index.html ├── runtime-es5.741402d1d47331ce975c.js ├── runtime-es2015.858f8dd898b75fe86926.js ├── styles.4070877cbd527ec88ddf.css ├── 3rdpartylicenses.txt └── polyfills-es2015.5728f680576ca47e99fe.js ├── config └── database.js ├── .idea ├── misc.xml ├── vcs.xml ├── modules.xml ├── officeapi.iml └── workspace.xml ├── models ├── crew.js ├── character.js ├── quote.js └── episode.js ├── package.json ├── controllers ├── crewController.js ├── characterController.js ├── episodeController.js └── quoteController.js ├── app.js └── routes └── api-routes.js /officeapi/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | idea/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /officeapi/src/app/components/homepage/homepage.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /officeapi/src/app/components/homepage/homepage.component.html: -------------------------------------------------------------------------------- 1 |

homepage works!

2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # officeapi 2 | RESTful API built with NodeJS, Express, MongoDB and Mongoose 3 | -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/angular-prism.d.ts: -------------------------------------------------------------------------------- 1 | export * from './src/prism.component'; 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /officeapi/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/favicon.ico -------------------------------------------------------------------------------- /officeapi/src/fonts/Typist.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/fonts/Typist.ttf -------------------------------------------------------------------------------- /public/assets/1.-mike-office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/1.-mike-office.png -------------------------------------------------------------------------------- /public/assets/2.-jim-and-pam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/2.-jim-and-pam.png -------------------------------------------------------------------------------- /public/assets/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/favicon-16x16.png -------------------------------------------------------------------------------- /public/assets/officeApiLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/officeApiLogo.png -------------------------------------------------------------------------------- /public/assets/OfficeApiFavicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/OfficeApiFavicon.png -------------------------------------------------------------------------------- /public/assets/4.-office-building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/4.-office-building.png -------------------------------------------------------------------------------- /officeapi/src/assets/1.-mike-office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/1.-mike-office.png -------------------------------------------------------------------------------- /officeapi/src/assets/2.-jim-and-pam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/2.-jim-and-pam.png -------------------------------------------------------------------------------- /officeapi/src/assets/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/favicon-16x16.png -------------------------------------------------------------------------------- /officeapi/src/assets/officeApiLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/officeApiLogo.png -------------------------------------------------------------------------------- /public/Typist.733f9a18362faa2cdd69.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/Typist.733f9a18362faa2cdd69.ttf -------------------------------------------------------------------------------- /officeapi/src/assets/OfficeApiFavicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/OfficeApiFavicon.png -------------------------------------------------------------------------------- /officeapi/src/assets/4.-office-building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/4.-office-building.png -------------------------------------------------------------------------------- /public/assets/2.-meeting-room,-prison-mike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/assets/2.-meeting-room,-prison-mike.png -------------------------------------------------------------------------------- /officeapi/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | url: 'https://www.officeapi.dev/api/' 4 | }; 5 | -------------------------------------------------------------------------------- /officeapi/src/fonts/AmericanTypewriterRegular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/fonts/AmericanTypewriterRegular.ttf -------------------------------------------------------------------------------- /config/database.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | database: 'mongodb+srv://officeapi-i1lqz.mongodb.net/test?retryWrites=true&w=majority', 3 | secret: 'yoursecret' 4 | }; -------------------------------------------------------------------------------- /officeapi/src/assets/2.-meeting-room,-prison-mike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/officeapi/src/assets/2.-meeting-room,-prison-mike.png -------------------------------------------------------------------------------- /public/AmericanTypewriterRegular.940ace70d6c766e685a2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braydoncoyer/officeapi/HEAD/public/AmericanTypewriterRegular.940ace70d6c766e685a2.ttf -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/angular-prism.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"angular-prism.js","sourceRoot":"","sources":["../angular-prism.ts"],"names":[],"mappings":";;;;;AAIA,2CAAsC"} -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /officeapi/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /officeapi/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /officeapi/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/angular-prism.ts: -------------------------------------------------------------------------------- 1 | //import { NgModule, ModuleWithProviders } from '@angular/core'; 2 | //import { CommonModule } from '@angular/common'; 3 | import { PrismComponent } from './src/prism.component'; 4 | 5 | export * from './src/prism.component'; 6 | -------------------------------------------------------------------------------- /officeapi/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /officeapi/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "include": [ 8 | "src/**/*.ts" 9 | ], 10 | "exclude": [ 11 | "src/test.ts", 12 | "src/**/*.spec.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /officeapi/src/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff -------------------------------------------------------------------------------- /.idea/officeapi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /officeapi/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /officeapi/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /officeapi/src/variables.scss: -------------------------------------------------------------------------------- 1 | $white-text-color: #FCFBFD; 2 | $light-grey: #E2E2E2; 3 | $office-blue: #033E5E; 4 | $dark-office-blue: #041528; 5 | $grey: #293B49; 6 | $dark-grey: #041528; 7 | $tree-green: #458239; 8 | $light-green: #77D6C1; 9 | $teal: #1C92A7; 10 | $dark-tree-green: #273B2D; 11 | $office-building: #6D8A8D; -------------------------------------------------------------------------------- /officeapi/.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 | -------------------------------------------------------------------------------- /officeapi/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 | -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/angular-prism.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function __export(m) { 3 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 4 | } 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | __export(require("./src/prism.component")); 7 | //# sourceMappingURL=angular-prism.js.map -------------------------------------------------------------------------------- /officeapi/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 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /officeapi/src/app/components/homepage/homepage.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-homepage', 5 | templateUrl: './homepage.component.html', 6 | styleUrls: ['./homepage.component.scss'] 7 | }) 8 | export class HomepageComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /officeapi/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Office API 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /officeapi/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import './codeblock.scss'; 3 | @import './variables.scss'; 4 | 5 | @font-face { 6 | font-family: typist; 7 | src: url(fonts/Typist.ttf) format("opentype"); 8 | } 9 | 10 | * { 11 | font-family: 'typist', Arial, Helvetica, sans-serif; 12 | line-height: 20px; 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /officeapi/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.error(err)); 13 | -------------------------------------------------------------------------------- /officeapi/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/src/prism.component.d.ts: -------------------------------------------------------------------------------- 1 | import {Renderer2, ElementRef, AfterViewInit, Directive} from '@angular/core'; 2 | 3 | export declare class PrismComponent implements AfterViewInit { 4 | private _renderer; 5 | private _el; 6 | code: string; 7 | language: string; 8 | private preNode; 9 | private codeNode; 10 | private nativeElement; 11 | ngAfterViewInit(): void; 12 | constructor(_renderer: Renderer2, _el: ElementRef); 13 | } 14 | -------------------------------------------------------------------------------- /models/crew.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const random = require('mongoose-simple-random'); 3 | 4 | // Character Schema 5 | 6 | const CrewSchema = mongoose.Schema({ 7 | name: { 8 | type: String 9 | }, 10 | role: { 11 | type: String 12 | } 13 | }); 14 | 15 | CrewSchema.plugin(random); 16 | 17 | const Crew = module.exports = mongoose.model('crew', CrewSchema); 18 | 19 | module.exports.get = (callback, limit) => { 20 | Crew.find(callback).limit(limit); 21 | }; 22 | -------------------------------------------------------------------------------- /officeapi/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import {HomepageComponent} from './components/homepage/homepage.component'; 4 | 5 | const routes: Routes = [ 6 | // {path: '/home', component: HomepageComponent}, 7 | // {path: '', component: HomepageComponent} 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [RouterModule.forRoot(routes)], 12 | exports: [RouterModule] 13 | }) 14 | export class AppRoutingModule { } 15 | -------------------------------------------------------------------------------- /officeapi/src/app/services/api.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { environment } from '../../environments/environment'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class ApiService { 10 | 11 | constructor(private http: HttpClient) { } 12 | 13 | get(endpoint: string): Observable { 14 | console.log(endpoint); 15 | return this.http.get(`${environment.url}${endpoint}`); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /officeapi/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /models/character.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const random = require('mongoose-simple-random'); 3 | 4 | // Character Schema 5 | 6 | const CharacterSchema = mongoose.Schema({ 7 | firstname: { 8 | type: String 9 | }, 10 | lastname: { 11 | type: String 12 | } 13 | }); 14 | 15 | CharacterSchema.plugin(random); 16 | 17 | const Character = module.exports = mongoose.model('character', CharacterSchema); 18 | 19 | module.exports.get = (callback, limit) => { 20 | Character.find(callback).limit(limit); 21 | }; 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "officeapi", 3 | "version": "1.0.0", 4 | "description": "A free JSON API for quotes, facts and information on NBC's beloved mockumentary series The Office", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node app" 9 | }, 10 | "dependencies": { 11 | "body-parser": "*", 12 | "cors": "*", 13 | "express": "*", 14 | "mongoose": "*", 15 | "mongoose-simple-random": "^0.4.1" 16 | }, 17 | "author": "Braydon Coyer", 18 | "license": "ISC" 19 | } 20 | -------------------------------------------------------------------------------- /officeapi/.idea/officeapi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /models/quote.js: -------------------------------------------------------------------------------- 1 | // import * as Schema from "mongoose"; 2 | 3 | const mongoose = require('mongoose'); 4 | const random = require('mongoose-simple-random'); 5 | 6 | // Quote Schema 7 | const QuoteSchema = mongoose.Schema({ 8 | content: { 9 | type: String, 10 | required: true 11 | }, 12 | character: { 13 | type: mongoose.Schema.Types.ObjectId, ref: 'character', 14 | required: true 15 | } 16 | }); 17 | 18 | QuoteSchema.plugin(random); 19 | 20 | const Quote = module.exports = mongoose.model('quote', QuoteSchema); 21 | 22 | module.exports.get = (callback, limit) => { 23 | Quote.find(callback).limit(limit); 24 | }; 25 | -------------------------------------------------------------------------------- /officeapi/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 | -------------------------------------------------------------------------------- /officeapi/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 officeapi!'); 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 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /officeapi/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 | url: 'http://localhost:8080/api/' 8 | }; 9 | 10 | /* 11 | * For easier debugging in development mode, you can import the following file 12 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 13 | * 14 | * This import should be commented out in production mode because it will have a negative impact 15 | * on performance if an error is thrown. 16 | */ 17 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 18 | -------------------------------------------------------------------------------- /officeapi/src/app/components/homepage/homepage.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomepageComponent } from './homepage.component'; 4 | 5 | describe('HomepageComponent', () => { 6 | let component: HomepageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ HomepageComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomepageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /officeapi/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | ./officeapi/.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Office API 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /models/episode.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const random = require('mongoose-simple-random'); 3 | 4 | // Episode Schema 5 | const EpisodeSchema = mongoose.Schema({ 6 | title: { 7 | type: String, 8 | required: true 9 | }, 10 | description: { 11 | type: String, 12 | required: true 13 | }, 14 | writer: { 15 | type: mongoose.Schema.Types.ObjectId, ref: 'crew', 16 | required: true 17 | }, 18 | director: { 19 | type: mongoose.Schema.Types.ObjectId, ref: 'crew', 20 | required: true 21 | }, 22 | airDate: { 23 | type: Date, 24 | required: true 25 | } 26 | }); 27 | 28 | EpisodeSchema.plugin(random); 29 | 30 | const Episode = module.exports = mongoose.model('episode', EpisodeSchema); 31 | 32 | module.exports.get = (callback, limit) => { 33 | Episode.find(callback).limit(limit); 34 | }; 35 | -------------------------------------------------------------------------------- /officeapi/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /officeapi/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /officeapi/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 { FormsModule } from '@angular/forms'; 6 | import { AppComponent } from './app.component'; 7 | 8 | import { FlexLayoutModule } from '@angular/flex-layout'; 9 | import { HomepageComponent } from './components/homepage/homepage.component'; 10 | import {HttpClientModule} from '@angular/common/http'; 11 | 12 | import 'prismjs/prism'; 13 | import 'prismjs/components/prism-typescript'; 14 | 15 | import { PrismComponent } from './angular-prism/angular-prism'; 16 | 17 | @NgModule({ 18 | declarations: [ 19 | AppComponent, 20 | HomepageComponent, 21 | PrismComponent, 22 | ], 23 | imports: [ 24 | BrowserModule, 25 | AppRoutingModule, 26 | FlexLayoutModule, 27 | HttpClientModule, 28 | FormsModule 29 | ], 30 | providers: [], 31 | bootstrap: [AppComponent] 32 | }) 33 | export class AppModule { } 34 | -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/src/prism.component.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"prism.component.js","sourceRoot":"","sources":["../../src/prism.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,wCAAuF;AAOvF,IAAa,cAAc,GAA3B;IAeE,YAAoB,SAAoB,EAAU,GAAe;QAA7C,cAAS,GAAT,SAAS,CAAW;QAAU,QAAG,GAAH,GAAG,CAAY;QAC/D,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC;IAEzC,CAAC;IAZD,eAAe;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;QACtC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;CAKF,CAAA;AAlBU;IAAR,YAAK,EAAE;;4CAAc;AACb;IAAR,YAAK,EAAE;;gDAAkB;AAFf,cAAc;IAJ1B,gBAAS,CAAC;QACT,QAAQ,EAAE,aAAa;QACvB,QAAQ,EAAE,EAAE;KACb,CAAC;qCAgB+B,gBAAS,EAAe,iBAAU;GAftD,cAAc,CAmB1B;AAnBY,wCAAc"} -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/src/prism.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, Renderer2, ElementRef, AfterViewInit } from '@angular/core'; 2 | declare var Prism: any; 3 | 4 | @Component({ 5 | selector: 'prism-block', 6 | template: ``, 7 | }) 8 | export class PrismComponent implements AfterViewInit { 9 | @Input() code: string; 10 | @Input() language: string; 11 | private preNode: Node; 12 | private codeNode: Node; 13 | private nativeElement: Node; 14 | ngAfterViewInit () { 15 | this.preNode = this._renderer.createElement('pre'); 16 | this.codeNode = this._renderer.createElement('code'); 17 | this._renderer.addClass(this.codeNode, 'language-' + this.language); 18 | this._renderer.appendChild(this.nativeElement, this.preNode); 19 | this._renderer.appendChild(this.preNode, this.codeNode); 20 | this.codeNode.textContent = this.code; 21 | Prism.highlightElement(this.codeNode); 22 | } 23 | constructor(private _renderer: Renderer2, private _el: ElementRef) { 24 | this.nativeElement = _el.nativeElement; 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /officeapi/README.md: -------------------------------------------------------------------------------- 1 | # Officeapi 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.2. 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 | -------------------------------------------------------------------------------- /officeapi/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/officeapi'), 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 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /public/runtime-es5.741402d1d47331ce975c.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c { 7 | if(err) { 8 | res.json({ 9 | status: "err", 10 | message: err 11 | }); 12 | } 13 | res.json({ 14 | data: crew 15 | }); 16 | }) 17 | }; 18 | 19 | 20 | // Get random Character 21 | exports.random = (req, res) => { 22 | Crew.findOneRandom((err, crew) => { 23 | if (err) { 24 | res.json({ 25 | status: "err", 26 | message: err 27 | }); 28 | } 29 | res.json({ 30 | data: crew 31 | }); 32 | }); 33 | }; 34 | 35 | // Get Character by ID 36 | exports.index = (req, res) => { 37 | Crew.findById(req.params.crew_id, (err, crew) => { 38 | if(err) { 39 | res.send(err); 40 | }; 41 | 42 | res.json({ 43 | data: crew 44 | }); 45 | }) 46 | }; 47 | 48 | 49 | // Create new Character 50 | exports.new = function (req, res) { 51 | let crew = new Crew(); 52 | crew.name = req.body.name ? req.body.name : crew.name; 53 | crew.role = req.body.role ? req.body.role : crew.role; 54 | 55 | crew.save(function (err) { 56 | if(err) { 57 | res.json(err); 58 | } 59 | res.json({ 60 | message: 'New crew member created!', 61 | data: crew 62 | }) 63 | }) 64 | }; 65 | -------------------------------------------------------------------------------- /officeapi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "officeapi", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test --watch=true --browsers=ChromeHeadless", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~8.0.0", 15 | "@angular/cdk": "^8.1.1", 16 | "@angular/common": "~8.0.0", 17 | "@angular/compiler": "~8.0.0", 18 | "@angular/core": "~8.0.0", 19 | "@angular/flex-layout": "^8.0.0-beta.26", 20 | "@angular/forms": "~8.0.0", 21 | "@angular/platform-browser": "~8.0.0", 22 | "@angular/platform-browser-dynamic": "~8.0.0", 23 | "@angular/router": "~8.0.0", 24 | "angular-prism": "^0.1.20", 25 | "rxjs": "~6.4.0", 26 | "tslib": "^1.9.0", 27 | "zone.js": "~0.9.1" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "~0.800.0", 31 | "@angular/cli": "~8.0.2", 32 | "@angular/compiler-cli": "~8.0.0", 33 | "@angular/language-service": "~8.0.0", 34 | "@types/node": "~8.9.4", 35 | "@types/jasmine": "~3.3.8", 36 | "@types/jasminewd2": "~2.0.3", 37 | "codelyzer": "^5.0.0", 38 | "jasmine-core": "~3.4.0", 39 | "jasmine-spec-reporter": "~4.2.1", 40 | "karma": "~4.1.0", 41 | "karma-chrome-launcher": "~2.2.0", 42 | "karma-coverage-istanbul-reporter": "~2.0.1", 43 | "karma-jasmine": "~2.0.1", 44 | "karma-jasmine-html-reporter": "^1.4.0", 45 | "protractor": "~5.4.0", 46 | "ts-node": "~7.0.0", 47 | "tslint": "~5.15.0", 48 | "typescript": "~3.4.3" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /controllers/characterController.js: -------------------------------------------------------------------------------- 1 | Character = require('../models/character'); 2 | 3 | 4 | // Get all Characters 5 | exports.view = async function (req, res) { 6 | Character.get((err, characters) => { 7 | if(err) { 8 | res.json({ 9 | status: "err", 10 | message: err 11 | }); 12 | } 13 | res.json({ 14 | data: characters 15 | }); 16 | }) 17 | }; 18 | 19 | 20 | // Get random Character 21 | exports.random = (req, res) => { 22 | Character.findOneRandom((err, character) => { 23 | if (err) { 24 | res.json({ 25 | status: "err", 26 | message: err 27 | }); 28 | } 29 | res.json({ 30 | data: character 31 | }); 32 | }); 33 | }; 34 | 35 | // Get Character by ID 36 | exports.index = (req, res) => { 37 | Character.findById(req.params.character_id, (err, character) => { 38 | if(err) { 39 | res.send(err); 40 | }; 41 | 42 | res.json({ 43 | data: character 44 | }); 45 | }) 46 | }; 47 | 48 | 49 | // Create new Character 50 | exports.new = function (req, res) { 51 | let character = new Character(); 52 | character.firstname = req.body.firstname ? req.body.firstname : character.firstname; 53 | character.lastname = req.body.lastname ? req.body.lastname : character.lastname; 54 | 55 | character.save(function (err) { 56 | if(err) { 57 | res.json(err); 58 | } 59 | res.json({ 60 | message: 'New character created!', 61 | data: character 62 | }) 63 | }) 64 | }; 65 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const path = require('path'); 3 | const bodyParser = require('body-parser'); 4 | const cors = require('cors'); 5 | 6 | const mongoose = require('mongoose'); 7 | const config = require('./config/database'); 8 | 9 | const app = express(); 10 | app.use(cors()); 11 | 12 | const apiRoutes = require('./routes/api-routes'); 13 | app.use(bodyParser.urlencoded({ 14 | extended: true 15 | })); 16 | app.use(bodyParser.json()); 17 | 18 | //Enable CORS Middleware 19 | // app.use(cors(corsOptions)); 20 | const port = process.env.PORT || 8080; 21 | 22 | // Configure DB 23 | mongoose.connect(config.database, { 24 | dbName: 'test', 25 | user: 'braydon123', 26 | pass: 'braydon123', 27 | useNewUrlParser: true, 28 | useUnifiedTopology: true 29 | }); 30 | 31 | // Connect to DB 32 | mongoose.connection.on('connected', () => { 33 | console.log('Connected to MongoDB'); 34 | }); 35 | 36 | // If there is a DB error 37 | mongoose.connection.on('error', (err) => { 38 | console.log(`Database error: ${err}`); 39 | }); 40 | 41 | const db = mongoose.connection; 42 | 43 | 44 | // Set static folder 45 | app.use(express.static(path.join(__dirname, 'public'))); 46 | 47 | // Body Parser Middleware 48 | app.use(bodyParser.json()); 49 | 50 | // Define base url 51 | app.get('/', (req, res) => { 52 | res.send('Invalid Enpoint!'); 53 | }); 54 | 55 | // // Define base url 56 | // app.get('*', (req, res) => { 57 | // res.sendFile(path.join(__dirname, 'public/index.html')); 58 | // }); 59 | 60 | // Use API routes 61 | app.use('/api', apiRoutes); 62 | 63 | 64 | // Listen on the port defined 65 | app.listen(port, () => { 66 | console.log('Server is running on port ' + port); 67 | }); 68 | -------------------------------------------------------------------------------- /controllers/episodeController.js: -------------------------------------------------------------------------------- 1 | Episode = require('../models/episode'); 2 | 3 | 4 | // Get all Episodes 5 | exports.view = async function (req, res) { 6 | Episode.find().populate('writer').populate('director').exec((err, episode) => { 7 | if(err) { 8 | res.json({ 9 | status: "err", 10 | message: err 11 | }); 12 | } 13 | res.json({ 14 | data: episode 15 | }); 16 | }); 17 | }; 18 | 19 | // Get Episode by ID 20 | exports.index = (req, res) => { 21 | Episode.findById(req.params.episode_id, (err, episodes) => { 22 | if(err) { 23 | res.send(err); 24 | }; 25 | 26 | res.json({ 27 | data: episodes 28 | }); 29 | }) 30 | }; 31 | 32 | 33 | // Get random Episode 34 | exports.random = (req, res) => { 35 | Episode.findOneRandom((err, episode) => { 36 | if (err) { 37 | res.json({ 38 | status: "err", 39 | message: err 40 | }); 41 | } 42 | res.json({ 43 | data: episode 44 | }); 45 | }); 46 | }; 47 | 48 | 49 | // Create new Character 50 | exports.new = function (req, res) { 51 | let episode = new Episode(); 52 | episode.title = req.body.title ? req.body.title : episode.title; 53 | episode.description = req.body.description ? req.body.description : episode.description; 54 | episode.writer = req.body.writer ? req.body.writer : episode.writer; 55 | episode.director = req.body.director ? req.body.director : episode.director; 56 | episode.airDate = req.body.airDate ? req.body.airDate : episode.airDate; 57 | 58 | episode.save(function (err) { 59 | if(err) { 60 | res.json(err); 61 | } 62 | res.json({ 63 | message: 'New episode created!', 64 | data: episode 65 | }) 66 | }) 67 | }; 68 | -------------------------------------------------------------------------------- /routes/api-routes.js: -------------------------------------------------------------------------------- 1 | // Initialize express router 2 | let router = require('express').Router(); 3 | 4 | // Set default API response 5 | router.get('/', function (req, res) { 6 | res.json({ 7 | status: 'API Is Working', 8 | message: 'Welcome to the OfficeApi! Try hitting the following endpoints: /episodes, /characters or /episodes' 9 | }); 10 | }); 11 | 12 | const characterController = require('../controllers/characterController'); 13 | const crewController = require('../controllers/crewController'); 14 | const episodeController = require('../controllers/episodeController'); 15 | const quoteController = require('../controllers/quoteController'); 16 | 17 | 18 | // Character Routes 19 | router.route('/characters') 20 | .get(characterController.view) 21 | .post(characterController.new); 22 | 23 | router.route('/characters/random') 24 | .get(characterController.random); 25 | 26 | router.route('/characters/:character_id') 27 | .get(characterController.index); 28 | 29 | 30 | // Crew Routes 31 | router.route('/crew') 32 | .get(crewController.view) 33 | .post(crewController.new); 34 | 35 | router.route('/crew/random') 36 | .get(crewController.random); 37 | 38 | router.route('/crew/:crew_id') 39 | .get(crewController.index); 40 | 41 | 42 | 43 | // Episode Routes 44 | router.route('/episodes') 45 | .get(episodeController.view) 46 | .post(episodeController.new); 47 | 48 | router.route('/episodes/random') 49 | .get(episodeController.random); 50 | 51 | router.route('/episodes/:episode_id') 52 | .get(episodeController.index); 53 | 54 | 55 | // Quote Routes 56 | router.route('/quotes') 57 | .get(quoteController.view) 58 | .post(quoteController.new); 59 | 60 | router.route('/quotes/random') 61 | .get(quoteController.random); 62 | 63 | router.route('/quotes/:quote_id') 64 | .get(quoteController.index); 65 | 66 | 67 | 68 | 69 | // Export API routes 70 | module.exports = router; 71 | -------------------------------------------------------------------------------- /public/styles.4070877cbd527ec88ddf.css: -------------------------------------------------------------------------------- 1 | code[class*=language-],pre[class*=language-]{color:#fcfbfd;background:0 0;text-shadow:0 1px #293b49;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none;overflow-x:auto;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#041528}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#041528}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-bottom:3px solid #041528}:not(pre)>code[class*=language-],pre[class*=language-]{background:#293b49}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:rgba(255,255,255,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}@font-face{font-family:typist;src:url(Typist.733f9a18362faa2cdd69.ttf) format("opentype")}*{font-family:typist,Arial,Helvetica,sans-serif;line-height:20px} -------------------------------------------------------------------------------- /officeapi/src/app/services/api.service.spec.ts: -------------------------------------------------------------------------------- 1 | import {getTestBed, TestBed} from '@angular/core/testing'; 2 | 3 | import { ApiService } from './api.service'; 4 | import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; 5 | import { environment } from '../../environments/environment'; 6 | 7 | describe('ApiService', () => { 8 | let injector: TestBed; 9 | let service: ApiService; 10 | let httpMock: HttpTestingController; 11 | beforeEach(() => { 12 | TestBed.configureTestingModule({ 13 | imports: [HttpClientTestingModule], 14 | providers: [ApiService] 15 | }); 16 | injector = getTestBed(); 17 | service = injector.get(ApiService); 18 | httpMock = injector.get(HttpTestingController); 19 | }); 20 | 21 | afterEach(() => { 22 | httpMock.verify(); 23 | }); 24 | 25 | it('should be created', () => { 26 | expect(service).toBeTruthy(); 27 | }); 28 | 29 | it('should return a list of data when get method is called', () => { 30 | const dummyData = [ 31 | { 32 | value: 'some value' 33 | }, 34 | { 35 | value: 'some other value' 36 | }, 37 | { 38 | value: 'the third value' 39 | }, 40 | { 41 | value: 'the forth value' 42 | }, 43 | { 44 | value: 'the fifth value' 45 | }, 46 | { 47 | value: 'the sixth value' 48 | }, 49 | { 50 | value: 'the seventh value' 51 | }, 52 | { 53 | value: 'the 8th value' 54 | }, 55 | { 56 | value: 'the 9th value' 57 | }, 58 | { 59 | value: 'the 10th value' 60 | }, 61 | { 62 | value: 'the 11th value' 63 | }, 64 | ]; 65 | 66 | service.get('quotes').subscribe(result => { 67 | expect(result).toEqual(dummyData); 68 | }); 69 | 70 | const req = httpMock.expectOne(`${environment.url}quotes`); 71 | expect(req.request.method).toBe('GET'); 72 | req.flush(dummyData); 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /officeapi/src/app/angular-prism/dist/src/prism.component.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | const core_1 = require("@angular/core"); 13 | let PrismComponent = class PrismComponent { 14 | constructor(_renderer, _el) { 15 | this._renderer = _renderer; 16 | this._el = _el; 17 | this.nativeElement = _el.nativeElement; 18 | } 19 | ngAfterViewInit() { 20 | this.preNode = this._renderer.createElement('pre'); 21 | this.codeNode = this._renderer.createElement('code'); 22 | this._renderer.addClass(this.codeNode, 'language-' + this.language); 23 | this._renderer.appendChild(this.nativeElement, this.preNode); 24 | this._renderer.appendChild(this.preNode, this.codeNode); 25 | this.codeNode.textContent = this.code; 26 | Prism.highlightElement(this.codeNode); 27 | } 28 | }; 29 | __decorate([ 30 | core_1.Input(), 31 | __metadata("design:type", String) 32 | ], PrismComponent.prototype, "code", void 0); 33 | __decorate([ 34 | core_1.Input(), 35 | __metadata("design:type", String) 36 | ], PrismComponent.prototype, "language", void 0); 37 | PrismComponent = __decorate([ 38 | core_1.Component({ 39 | selector: 'prism-block', 40 | template: ``, 41 | }), 42 | __metadata("design:paramtypes", [core_1.Renderer2, core_1.ElementRef]) 43 | ], PrismComponent); 44 | exports.PrismComponent = PrismComponent; 45 | //# sourceMappingURL=prism.component.js.map -------------------------------------------------------------------------------- /officeapi/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "deprecation": { 7 | "severity": "warn" 8 | }, 9 | "component-class-suffix": true, 10 | "contextual-lifecycle": true, 11 | "directive-class-suffix": true, 12 | "directive-selector": [ 13 | true, 14 | "attribute", 15 | "app", 16 | "camelCase" 17 | ], 18 | "component-selector": [ 19 | true, 20 | "element", 21 | "app", 22 | "kebab-case" 23 | ], 24 | "import-blacklist": [ 25 | true, 26 | "rxjs/Rx" 27 | ], 28 | "interface-name": false, 29 | "max-classes-per-file": false, 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-consecutive-blank-lines": false, 47 | "no-console": [ 48 | true, 49 | "debug", 50 | "info", 51 | "time", 52 | "timeEnd", 53 | "trace" 54 | ], 55 | "no-empty": false, 56 | "no-inferrable-types": [ 57 | true, 58 | "ignore-params" 59 | ], 60 | "no-non-null-assertion": true, 61 | "no-redundant-jsdoc": true, 62 | "no-switch-case-fall-through": true, 63 | "no-use-before-declare": true, 64 | "no-var-requires": false, 65 | "object-literal-key-quotes": [ 66 | true, 67 | "as-needed" 68 | ], 69 | "object-literal-sort-keys": false, 70 | "ordered-imports": false, 71 | "quotemark": [ 72 | true, 73 | "single" 74 | ], 75 | "trailing-comma": false, 76 | "no-conflicting-lifecycle": true, 77 | "no-host-metadata-property": true, 78 | "no-input-rename": true, 79 | "no-inputs-metadata-property": true, 80 | "no-output-native": true, 81 | "no-output-on-prefix": true, 82 | "no-output-rename": true, 83 | "no-outputs-metadata-property": true, 84 | "template-banana-in-box": true, 85 | "template-no-negated-async": true, 86 | "use-lifecycle-interface": true, 87 | "use-pipe-transform-interface": true 88 | }, 89 | "rulesDirectory": [ 90 | "codelyzer" 91 | ] 92 | } -------------------------------------------------------------------------------- /controllers/quoteController.js: -------------------------------------------------------------------------------- 1 | Quote = require('../models/quote'); 2 | Character = require('../models/character'); 3 | 4 | 5 | // Get all Quotes 6 | exports.view = async function (req, res) { 7 | Quote.find().populate('character').exec((err, quote) => { 8 | if(err) { 9 | res.json({ 10 | status: "err", 11 | message: err 12 | }); 13 | } 14 | res.json({ 15 | data: quote 16 | }); 17 | }); 18 | }; 19 | 20 | 21 | // Get random Character 22 | exports.random = (req, res) => { 23 | Quote.findOneRandom( async (err, quote) => { 24 | if (err) { 25 | res.json({ 26 | status: "err", 27 | message: err 28 | }); 29 | } 30 | Character.findById(quote.character, (err, character) => { 31 | if(err) { 32 | res.send(err); 33 | }; 34 | 35 | const result = quote; 36 | result.character = character; 37 | 38 | res.json({ 39 | data: result 40 | }) 41 | }); 42 | }); 43 | }; 44 | 45 | // Get Character by ID 46 | exports.index = (req, res) => { 47 | Quote.findById(req.params.quote_id, (err, quote) => { 48 | if(err) { 49 | res.send(err); 50 | }; 51 | 52 | Character.findById(quote.character, (err, character) => { 53 | if(err) { 54 | res.send(err); 55 | }; 56 | 57 | const result = quote; 58 | result.character = character; 59 | 60 | res.json({ 61 | data: result 62 | }) 63 | }); 64 | }) 65 | }; 66 | 67 | 68 | // Create new Character 69 | exports.new = function (req, res) { 70 | let quote = new Quote(); 71 | quote.content = req.body.content ? req.body.content : quote.content; 72 | quote.character = req.body.character ? req.body.character : character.character; 73 | 74 | quote.save(function (err) { 75 | if(err) { 76 | res.json(err); 77 | } 78 | res.json({ 79 | message: 'New quote created!', 80 | data: quote 81 | }) 82 | }) 83 | }; 84 | 85 | const findCharacterObject = (characterId) => { 86 | Character.findById(characterId, (err, character) => { 87 | if(err) { 88 | res.send(err); 89 | }; 90 | 91 | return character; 92 | }); 93 | } 94 | -------------------------------------------------------------------------------- /officeapi/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; 2 | import {ApiService} from './services/api.service'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.scss'] 8 | }) 9 | export class AppComponent implements OnInit { 10 | 11 | response: Object; 12 | inputValue = 'quotes/random'; 13 | 14 | firstAPIResponse = ` 15 | { 16 | "_id": "5e93b4a43af44260882e33b0", 17 | "firstname": "Michael", 18 | "lastname": "Scott", 19 | "__v": 0 20 | }, 21 | `; 22 | 23 | randomQuoteCode = ` 24 | { 25 | "data": { 26 | "_id": "5e9668186a66e65486e244a5", 27 | "content": "Bears, Beets, Battlestar Galactica.", 28 | "character": { 29 | "_id": "5e93b4f03af44260882e33b1", 30 | "firstname": "Jim", 31 | "lastname": "Halpert", 32 | "__v": 0 33 | }, 34 | "__v": 0 35 | } 36 | } 37 | `; 38 | 39 | characterResourceResponse = ` 40 | "data": { 41 | "_id": "5e93b4f03af44260882e33b1", 42 | "firstname": "Jim", 43 | "lastname": "Halpert", 44 | "__v": 0 45 | } 46 | `; 47 | 48 | episodeResourceResponse = ` 49 | "data": { 50 | "_id": "5e94d646f733a1332868e1dc", 51 | "title": "Pilot", 52 | "description": "A documentary crew gives a firsthand introduction to the staff of the Scranton branch of the Dunder Mifflin Paper Company, managed by Michael Scott.", 53 | "airDate": "2005-03-24T06:00:00.000Z", 54 | "__v": 0 55 | } 56 | `; 57 | 58 | crewResourceResponse = ` 59 | "data": { 60 | "_id": "5e9524139511994a07f9a317", 61 | "name": "Michael Schur", 62 | "role": "Writer/Actor", 63 | "__v": 0 64 | } 65 | `; 66 | 67 | constructor(private apiService: ApiService, private ref: ChangeDetectorRef) {} 68 | 69 | ngOnInit() { 70 | this.apiService.get(this.inputValue).subscribe(result => { 71 | this.response = result; 72 | }); 73 | } 74 | 75 | fetchData() { 76 | this.apiService.get(this.inputValue).subscribe((result:any) => { 77 | this.response = null; 78 | this.ref.detectChanges(); 79 | if (result.data.length > 5) { 80 | this.response = result.data.slice(0, 5); 81 | } else { 82 | this.response = result; 83 | } 84 | }); 85 | } 86 | 87 | suggestionClicked(value: any) { 88 | this.response = null; 89 | this.inputValue = value; 90 | this.ref.detectChanges(); 91 | this.fetchData(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /officeapi/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__UNPATCHED_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 | -------------------------------------------------------------------------------- /officeapi/src/codeblock.scss: -------------------------------------------------------------------------------- 1 | @import './variables.scss'; 2 | 3 | code[class*="language-"], 4 | pre[class*="language-"] { 5 | color: $white-text-color; 6 | background: none; 7 | text-shadow: 0 1px $grey; 8 | font-size: 1em; 9 | text-align: left; 10 | white-space: pre; 11 | word-spacing: normal; 12 | word-break: normal; 13 | word-wrap: normal; 14 | line-height: 1.5; 15 | 16 | -moz-tab-size: 4; 17 | -o-tab-size: 4; 18 | tab-size: 4; 19 | 20 | -webkit-hyphens: none; 21 | -moz-hyphens: none; 22 | -ms-hyphens: none; 23 | hyphens: none; 24 | 25 | overflow-x: auto; 26 | white-space: pre-wrap; 27 | white-space: -moz-pre-wrap; 28 | white-space: -pre-wrap; 29 | white-space: -o-pre-wrap; 30 | word-wrap: break-word; 31 | } 32 | 33 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 34 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 35 | text-shadow: none; 36 | background: $dark-office-blue; 37 | } 38 | 39 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 40 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 41 | text-shadow: none; 42 | background: $dark-office-blue; 43 | } 44 | 45 | @media print { 46 | code[class*="language-"], 47 | pre[class*="language-"] { 48 | text-shadow: none; 49 | } 50 | } 51 | 52 | /* Code blocks */ 53 | pre[class*="language-"] { 54 | padding: 1em; 55 | margin: .5em 0; 56 | overflow: auto; 57 | border-bottom: 3px solid $dark-grey; 58 | } 59 | 60 | :not(pre) > code[class*="language-"], 61 | pre[class*="language-"] { 62 | background: $grey; 63 | } 64 | 65 | /* Inline code */ 66 | :not(pre) > code[class*="language-"] { 67 | padding: .1em; 68 | border-radius: .3em; 69 | white-space: normal; 70 | } 71 | 72 | .token.comment, 73 | .token.prolog, 74 | .token.doctype, 75 | .token.cdata { 76 | color: slategray; 77 | } 78 | 79 | .token.punctuation { 80 | color: #999; 81 | } 82 | 83 | .namespace { 84 | opacity: .7; 85 | } 86 | 87 | .token.property, 88 | .token.tag, 89 | .token.boolean, 90 | .token.number, 91 | .token.constant, 92 | .token.symbol, 93 | .token.deleted { 94 | color: #905; 95 | } 96 | 97 | .token.selector, 98 | .token.attr-name, 99 | .token.string, 100 | .token.char, 101 | .token.builtin, 102 | .token.inserted { 103 | color: #690; 104 | } 105 | 106 | .token.operator, 107 | .token.entity, 108 | .token.url, 109 | .language-css .token.string, 110 | .style .token.string { 111 | color: #9a6e3a; 112 | background: hsla(0, 0%, 100%, .5); 113 | } 114 | 115 | .token.atrule, 116 | .token.attr-value, 117 | .token.keyword { 118 | color: #07a; 119 | } 120 | 121 | .token.function, 122 | .token.class-name { 123 | color: #DD4A68; 124 | } 125 | 126 | .token.regex, 127 | .token.important, 128 | .token.variable { 129 | color: #e90; 130 | } 131 | 132 | .token.important, 133 | .token.bold { 134 | font-weight: bold; 135 | } 136 | .token.italic { 137 | font-style: italic; 138 | } 139 | 140 | .token.entity { 141 | cursor: help; 142 | } -------------------------------------------------------------------------------- /officeapi/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | @import '../variables.scss'; 2 | 3 | @font-face { 4 | font-family:"American Typewriter"; 5 | src: url("../fonts/AmericanTypewriterRegular.ttf") format("truetype"); 6 | } 7 | 8 | 9 | * { 10 | color: #2d2d2d; 11 | } 12 | 13 | .fullscreen_container { 14 | position: fixed; 15 | top: 0; 16 | left: 0; 17 | bottom: 0; 18 | right: 0; 19 | overflow: auto; 20 | background: #BFC3C6; 21 | } 22 | 23 | .welcome { 24 | margin-top: 25px; 25 | 26 | &__explanation { 27 | margin: 50px 0; 28 | } 29 | 30 | &__example > span { 31 | line-height: 40px; 32 | height: 40px; 33 | background-color: $dark-office-blue; 34 | color: #FCFBFD; 35 | text-align: center; 36 | border-bottom: solid 3px black; 37 | } 38 | 39 | &__example > input { 40 | height: 40px; 41 | border: none; 42 | padding: 7px; 43 | border-bottom: solid 3px $light-grey; 44 | } 45 | 46 | &__example > button { 47 | cursor: pointer; 48 | border: none; 49 | background-color: #6D8A8D; 50 | border-bottom: solid 3px #293B49; 51 | color: white; 52 | } 53 | 54 | &__example-result { 55 | margin-top: 15px; 56 | background-color: #FCFBFD; 57 | color: #2d2d2d; 58 | } 59 | 60 | &__example-http-container { 61 | line-height: 40px; 62 | height: 40px; 63 | background-color: $grey; 64 | text-align: center; 65 | border-bottom: solid 3px $dark-grey; 66 | & > span { 67 | color: #FCFBFD; 68 | } 69 | } 70 | 71 | &__example-suggestions{ 72 | display: flex; 73 | font-size: 12px; 74 | 75 | &-item { 76 | cursor: pointer; 77 | margin: 5px 0; 78 | margin-right: 20px; 79 | 80 | &-italic { 81 | font-size: 14px; 82 | font-weight: 1000; 83 | } 84 | } 85 | 86 | } 87 | 88 | &__example-disclaimer { 89 | font-size: 12px; 90 | } 91 | } 92 | 93 | section { 94 | margin: 3rem 0; 95 | } 96 | 97 | .media { 98 | margin: 45px 0; 99 | } 100 | 101 | .footer { 102 | font-size: 10px; 103 | } 104 | 105 | .tag { 106 | color: white; 107 | padding: 4px; 108 | background-color: $dark-office-blue; 109 | border-radius: 5px; 110 | } 111 | 112 | 113 | ul > li { 114 | margin: 10px 0; 115 | } 116 | 117 | .resource { 118 | margin-bottom: 6rem; 119 | } 120 | 121 | 122 | 123 | 124 | 125 | 126 | /* --------------------- MEDIA QUERIES --------------------- */ 127 | 128 | /* Extra small devices (phones, 600px and down) */ 129 | @media only screen and (max-width: 600px) { 130 | .content { 131 | width: 95%; 132 | margin: 0 auto; 133 | } 134 | 135 | .welcome { 136 | margin-top: 10px; 137 | 138 | &__example-http-container { 139 | font-size: 10px; 140 | } 141 | } 142 | } 143 | 144 | /* Small devices (portrait tablets and large phones, 600px and up) */ 145 | @media only screen and (min-width: 600px) { 146 | .content { 147 | width: 85%; 148 | margin: 0 auto; 149 | } 150 | } 151 | 152 | /* Medium devices (landscape tablets, 768px and up) */ 153 | @media only screen and (min-width: 768px) { 154 | .content { 155 | width: 75%; 156 | margin: 0 auto; 157 | } 158 | } 159 | 160 | ///* Large devices (laptops/desktops, 992px and up) */ 161 | //@media only screen and (min-width: 992px) { 162 | // .content { 163 | // width: 50%; 164 | // margin: 0 auto; 165 | // } 166 | //} 167 | 168 | /* iPad Pro Portrait */ 169 | @media only screen and (min-width: 1024px) { 170 | .content { 171 | width: 60%; 172 | margin: 0 auto; 173 | } 174 | } 175 | 176 | /* Extra Large devices (laptops/desktops, 992px and up) */ 177 | @media only screen and (min-width: 1026px) { 178 | .content { 179 | width: 40%; 180 | margin: 0 auto; 181 | } 182 | } 183 | 184 | 185 | -------------------------------------------------------------------------------- /officeapi/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "officeapi": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "../public", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": false, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss" 32 | ], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "src/environments/environment.ts", 40 | "with": "src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "extractCss": true, 47 | "namedChunks": false, 48 | "aot": true, 49 | "extractLicenses": true, 50 | "vendorChunk": false, 51 | "buildOptimizer": true, 52 | "budgets": [ 53 | { 54 | "type": "initial", 55 | "maximumWarning": "2mb", 56 | "maximumError": "5mb" 57 | } 58 | ] 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "officeapi:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "officeapi:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "officeapi:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "tsconfig.spec.json", 85 | "karmaConfig": "karma.conf.js", 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ], 90 | "styles": [ 91 | "src/styles.scss" 92 | ], 93 | "scripts": [] 94 | } 95 | }, 96 | "lint": { 97 | "builder": "@angular-devkit/build-angular:tslint", 98 | "options": { 99 | "tsConfig": [ 100 | "tsconfig.app.json", 101 | "tsconfig.spec.json", 102 | "e2e/tsconfig.json" 103 | ], 104 | "exclude": [ 105 | "**/node_modules/**" 106 | ] 107 | } 108 | }, 109 | "e2e": { 110 | "builder": "@angular-devkit/build-angular:protractor", 111 | "options": { 112 | "protractorConfig": "e2e/protractor.conf.js", 113 | "devServerTarget": "officeapi:serve" 114 | }, 115 | "configurations": { 116 | "production": { 117 | "devServerTarget": "officeapi:serve:production" 118 | } 119 | } 120 | } 121 | } 122 | }}, 123 | "defaultProject": "officeapi" 124 | } 125 | -------------------------------------------------------------------------------- /officeapi/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import {TestBed, async, ComponentFixture} from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | import {Component, Input} from '@angular/core'; 5 | import {ApiService} from './services/api.service'; 6 | import {FormsModule} from "@angular/forms"; 7 | import {of} from "rxjs"; 8 | 9 | @Component({ 10 | // tslint:disable-next-line:component-selector 11 | selector: 'prism-block', 12 | template: ' ' 13 | }) 14 | class MockPrismComponent { 15 | @Input() code: any; 16 | } 17 | 18 | class MockAPIService { 19 | get(url: string) { 20 | 21 | } 22 | } 23 | 24 | describe('AppComponent', () => { 25 | 26 | let service; 27 | let component: AppComponent; 28 | let fixture: ComponentFixture; 29 | 30 | beforeEach(async(() => { 31 | TestBed.configureTestingModule({ 32 | imports: [ 33 | RouterTestingModule, FormsModule 34 | ], 35 | declarations: [ 36 | AppComponent, MockPrismComponent 37 | ], 38 | providers: [{provide: ApiService, useClass: MockAPIService}] 39 | }).compileComponents(); 40 | })); 41 | 42 | beforeEach(() => { 43 | fixture = TestBed.createComponent(AppComponent); 44 | component = fixture.componentInstance; 45 | service = TestBed.get(ApiService); 46 | }) 47 | 48 | it('should create the app', () => { 49 | expect(component).toBeTruthy(); 50 | }); 51 | 52 | it('should call the api service on ngOnInit', () => { 53 | const spy = spyOn(service, 'get').and.returnValue(of(null)); 54 | component.ngOnInit(); 55 | expect(spy).toHaveBeenCalled(); 56 | }); 57 | 58 | it('should populate the response property after calling the service on ngOnInit', () => { 59 | const dummyData = { 60 | value: 'some value' 61 | }; 62 | 63 | spyOn(service, 'get').and.returnValue(of(dummyData)); 64 | component.ngOnInit(); 65 | expect(component.response).toEqual(dummyData); 66 | }); 67 | 68 | it('should call the api Service when fetchData is called', () => { 69 | const spy = spyOn(service, 'get').and.returnValue(of(null)); 70 | component.fetchData(); 71 | expect(spy).toHaveBeenCalled(); 72 | }); 73 | 74 | it('should set the response property to the result if the result has less than 5 items', () => { 75 | const dummyData = [ 76 | { 77 | value: 'some value' 78 | }, 79 | { 80 | value: 'some other value' 81 | }, 82 | { 83 | value: 'the third value' 84 | }, 85 | { 86 | value: 'the forth value' 87 | }, 88 | ]; 89 | 90 | spyOn(service, 'get').and.returnValue(of(dummyData)); 91 | component.fetchData(); 92 | expect(component.response).toEqual(dummyData); 93 | }); 94 | 95 | 96 | it('should set the response property to the first 5 results if the result has more than 10 items', () => { 97 | const dummyData = [ 98 | { 99 | value: 'some value' 100 | }, 101 | { 102 | value: 'some other value' 103 | }, 104 | { 105 | value: 'the third value' 106 | }, 107 | { 108 | value: 'the forth value' 109 | }, 110 | { 111 | value: 'the fifth value' 112 | }, 113 | { 114 | value: 'the sixth value' 115 | }, 116 | { 117 | value: 'the seventh value' 118 | }, 119 | { 120 | value: 'the 8th value' 121 | }, 122 | { 123 | value: 'the 9th value' 124 | }, 125 | { 126 | value: 'the 10th value' 127 | }, 128 | { 129 | value: 'the 11th value' 130 | }, 131 | ]; 132 | 133 | spyOn(service, 'get').and.returnValue(of(dummyData)); 134 | component.fetchData(); 135 | expect(component.response).toEqual(dummyData.slice(0, 5)); 136 | }); 137 | 138 | it('should set the component properties to the appropriate values when suggestionClicked is called', () => { 139 | spyOn(service, 'get').and.returnValue(of(null)); 140 | component.response = {name: 'test'}; 141 | component.suggestionClicked('a string'); 142 | expect(component.response).toBeNull(); 143 | expect(component.inputValue).toBe('a string'); 144 | }); 145 | 146 | it('should call fetchData when suggestionClicked is called', () => { 147 | const spy = spyOn(component, 'fetchData'); 148 | component.suggestionClicked('a string'); 149 | expect(spy).toHaveBeenCalled(); 150 | }); 151 | }); 152 | -------------------------------------------------------------------------------- /officeapi/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 8 |
9 |

officeapi.dev is a free JSON API for quotes, facts and information on NBC’s beloved mockumentary series The Office.

10 |
11 | 12 |

Try An Example

13 |
14 |
15 | https://officeapi.dev/api/ 16 |
17 | 18 | 19 |
20 |
21 |

try episodes/

22 |

try characters/

23 |
24 |
25 | 26 |
27 |

* Max of 5 results shown. Actual data length may vary.

28 |
29 | 30 |
31 | Prison Mike 32 |

Documentation

33 |
34 | 35 |
36 |
37 |

Introduction

38 |

Welcome to the officeapi.dev! This documentation should help familiarise yourself with the resources available and how to consume them with HTTP requests.

39 | 40 |

What is a REST API?

41 |

An API is an application programming interface - in short, it’s a set of rules and instructions that lets programs talk to each other, exposing data and functionality across the internet in a consistent format.

42 |

REST stands for Representational State Transfer. This is an architectural pattern that describes how distributed systems can expose a consistent interface. When people use the term ‘REST API,’ they are generally referring to an API accessed via HTTP protocol at a predefined set of URLs.

43 |

These URLs represent various resources - any information or content accessed at that location, which can be returned as JSON, HTML, audio files, or images. Often, resources have one or more methods that can be performed on them over HTTP, like GET, POST, PUT and DELETE.

44 |

The officeapi.dev only allows you to GET data; all other operations are prohibited.

45 |
46 | 47 |
48 |

Usage

49 |

Let's make our first API request to the officeapi.dev!

50 |

Open a terminal and use curl or httpie to make the following request to get a character from the API:

51 | 52 |

After making that request, you will get a response much like the following:

53 | 54 |

If your response looks slightly different, that's okay - we've most likely updated the response with new data.

55 |
56 | 57 | Michael's office 58 | 59 |
60 |

Resources

61 |

The following resources are available through the officeapi:

62 |
    63 |
  • quotes string -- the URL root for quote resources
  • 64 |
  • characters string -- the URL root for character resources
  • 65 |
  • episodes string -- the URL root for episode resources
  • 66 |
  • crew string -- the URL root for crew resources
  • 67 |
68 |
69 |
70 |
71 |
72 |

Quotes

73 |

A quote resource is a phrase said by a character.

74 |

Endpoints

75 |
    76 |
  • /quotes/ -- get a list of all quotes in our database.
  • 77 |
  • /quotes/:id/ -- get a specific quote by id.
  • 78 | 79 |
  • /quotes/random -- get a random quote from any character.
  • 80 |
81 | 82 |

As an example, if I make a request for a random quote, the response will be similar to the following:

83 |
84 |

Example request:

85 | 86 | 87 | 88 |
89 | 90 |
91 |

Characters

92 |

A character resource is an entity representing a personality portrayed on the tv show.

93 |

Endpoints

94 |
    95 |
  • /characters/ -- get a list of all characters in our database.
  • 96 |
  • /characters/:id/ -- get a specific character by id.
  • 97 |
  • /characters/random -- get a random character in our database.
  • 98 |
99 | 100 |

As an example, if I wanted to get Jim Halpert back from the database, the request would look like the following:

101 |
102 |

Example request:

103 | 104 | 105 | 106 |
107 | 108 |
109 |

Episodes

110 |

An episode resource is an entity representing a specific installment from the tv show.

111 |

Our database contains information for each episode from the series.

112 |

Endpoints

113 |
    114 |
  • /episodes/ -- get a list of all episodes in our database.
  • 115 |
  • /episodes/:id/ -- get a specific episode by id.
  • 116 |
  • /episodes/random -- get a random episode from our database.
  • 117 |
118 | 119 |

As an example, if I wanted to get the data related to the pilot episode in season one, the request would look like the following:

120 |
121 |

Example request:

122 | 123 | 124 | 125 |
126 | 127 |
128 |

Crew

129 |

A crew resource is an entity representing a crew member from the tv show. A crew member can be an actor, writer or director, as indicated by the 'role' property on the resource returned.

130 |

Endpoints

131 |
    132 |
  • /crew/ -- get a list of all crew members in our database.
  • 133 |
  • /crew/:id/ -- get a specific crew resource by id.
  • 134 |
  • /crew/random -- get a random crew member from our database.
  • 135 |
136 | 137 |

As an example, if I wanted to get the data related to writer and actor Michael Schur, the request would look like the following:

138 |
139 |

Example request:

140 | 141 | 142 | 143 |
144 | 145 |
146 |
147 | 148 | 149 | 150 |
151 | The Office Building 152 | 157 |
158 | 159 |
160 |
161 | 162 | 163 | -------------------------------------------------------------------------------- /public/3rdpartylicenses.txt: -------------------------------------------------------------------------------- 1 | @angular/cdk 2 | MIT 3 | The MIT License 4 | 5 | Copyright (c) 2019 Google LLC. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | 26 | @angular/common 27 | MIT 28 | 29 | @angular/core 30 | MIT 31 | 32 | @angular/flex-layout 33 | MIT 34 | The MIT License 35 | 36 | Copyright (c) 2019 Google LLC. 37 | 38 | Permission is hereby granted, free of charge, to any person obtaining a copy 39 | of this software and associated documentation files (the "Software"), to deal 40 | in the Software without restriction, including without limitation the rights 41 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 42 | copies of the Software, and to permit persons to whom the Software is 43 | furnished to do so, subject to the following conditions: 44 | 45 | The above copyright notice and this permission notice shall be included in 46 | all copies or substantial portions of the Software. 47 | 48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 54 | THE SOFTWARE. 55 | 56 | 57 | @angular/forms 58 | MIT 59 | 60 | @angular/platform-browser 61 | MIT 62 | 63 | @angular/router 64 | MIT 65 | 66 | prismjs 67 | MIT 68 | MIT LICENSE 69 | 70 | Copyright (c) 2012 Lea Verou 71 | 72 | Permission is hereby granted, free of charge, to any person obtaining a copy 73 | of this software and associated documentation files (the "Software"), to deal 74 | in the Software without restriction, including without limitation the rights 75 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 76 | copies of the Software, and to permit persons to whom the Software is 77 | furnished to do so, subject to the following conditions: 78 | 79 | The above copyright notice and this permission notice shall be included in 80 | all copies or substantial portions of the Software. 81 | 82 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 83 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 84 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 85 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 86 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 87 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 88 | THE SOFTWARE. 89 | 90 | 91 | rxjs 92 | Apache-2.0 93 | Apache License 94 | Version 2.0, January 2004 95 | http://www.apache.org/licenses/ 96 | 97 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 98 | 99 | 1. Definitions. 100 | 101 | "License" shall mean the terms and conditions for use, reproduction, 102 | and distribution as defined by Sections 1 through 9 of this document. 103 | 104 | "Licensor" shall mean the copyright owner or entity authorized by 105 | the copyright owner that is granting the License. 106 | 107 | "Legal Entity" shall mean the union of the acting entity and all 108 | other entities that control, are controlled by, or are under common 109 | control with that entity. For the purposes of this definition, 110 | "control" means (i) the power, direct or indirect, to cause the 111 | direction or management of such entity, whether by contract or 112 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 113 | outstanding shares, or (iii) beneficial ownership of such entity. 114 | 115 | "You" (or "Your") shall mean an individual or Legal Entity 116 | exercising permissions granted by this License. 117 | 118 | "Source" form shall mean the preferred form for making modifications, 119 | including but not limited to software source code, documentation 120 | source, and configuration files. 121 | 122 | "Object" form shall mean any form resulting from mechanical 123 | transformation or translation of a Source form, including but 124 | not limited to compiled object code, generated documentation, 125 | and conversions to other media types. 126 | 127 | "Work" shall mean the work of authorship, whether in Source or 128 | Object form, made available under the License, as indicated by a 129 | copyright notice that is included in or attached to the work 130 | (an example is provided in the Appendix below). 131 | 132 | "Derivative Works" shall mean any work, whether in Source or Object 133 | form, that is based on (or derived from) the Work and for which the 134 | editorial revisions, annotations, elaborations, or other modifications 135 | represent, as a whole, an original work of authorship. For the purposes 136 | of this License, Derivative Works shall not include works that remain 137 | separable from, or merely link (or bind by name) to the interfaces of, 138 | the Work and Derivative Works thereof. 139 | 140 | "Contribution" shall mean any work of authorship, including 141 | the original version of the Work and any modifications or additions 142 | to that Work or Derivative Works thereof, that is intentionally 143 | submitted to Licensor for inclusion in the Work by the copyright owner 144 | or by an individual or Legal Entity authorized to submit on behalf of 145 | the copyright owner. For the purposes of this definition, "submitted" 146 | means any form of electronic, verbal, or written communication sent 147 | to the Licensor or its representatives, including but not limited to 148 | communication on electronic mailing lists, source code control systems, 149 | and issue tracking systems that are managed by, or on behalf of, the 150 | Licensor for the purpose of discussing and improving the Work, but 151 | excluding communication that is conspicuously marked or otherwise 152 | designated in writing by the copyright owner as "Not a Contribution." 153 | 154 | "Contributor" shall mean Licensor and any individual or Legal Entity 155 | on behalf of whom a Contribution has been received by Licensor and 156 | subsequently incorporated within the Work. 157 | 158 | 2. Grant of Copyright License. Subject to the terms and conditions of 159 | this License, each Contributor hereby grants to You a perpetual, 160 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 161 | copyright license to reproduce, prepare Derivative Works of, 162 | publicly display, publicly perform, sublicense, and distribute the 163 | Work and such Derivative Works in Source or Object form. 164 | 165 | 3. Grant of Patent License. Subject to the terms and conditions of 166 | this License, each Contributor hereby grants to You a perpetual, 167 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 168 | (except as stated in this section) patent license to make, have made, 169 | use, offer to sell, sell, import, and otherwise transfer the Work, 170 | where such license applies only to those patent claims licensable 171 | by such Contributor that are necessarily infringed by their 172 | Contribution(s) alone or by combination of their Contribution(s) 173 | with the Work to which such Contribution(s) was submitted. If You 174 | institute patent litigation against any entity (including a 175 | cross-claim or counterclaim in a lawsuit) alleging that the Work 176 | or a Contribution incorporated within the Work constitutes direct 177 | or contributory patent infringement, then any patent licenses 178 | granted to You under this License for that Work shall terminate 179 | as of the date such litigation is filed. 180 | 181 | 4. Redistribution. You may reproduce and distribute copies of the 182 | Work or Derivative Works thereof in any medium, with or without 183 | modifications, and in Source or Object form, provided that You 184 | meet the following conditions: 185 | 186 | (a) You must give any other recipients of the Work or 187 | Derivative Works a copy of this License; and 188 | 189 | (b) You must cause any modified files to carry prominent notices 190 | stating that You changed the files; and 191 | 192 | (c) You must retain, in the Source form of any Derivative Works 193 | that You distribute, all copyright, patent, trademark, and 194 | attribution notices from the Source form of the Work, 195 | excluding those notices that do not pertain to any part of 196 | the Derivative Works; and 197 | 198 | (d) If the Work includes a "NOTICE" text file as part of its 199 | distribution, then any Derivative Works that You distribute must 200 | include a readable copy of the attribution notices contained 201 | within such NOTICE file, excluding those notices that do not 202 | pertain to any part of the Derivative Works, in at least one 203 | of the following places: within a NOTICE text file distributed 204 | as part of the Derivative Works; within the Source form or 205 | documentation, if provided along with the Derivative Works; or, 206 | within a display generated by the Derivative Works, if and 207 | wherever such third-party notices normally appear. The contents 208 | of the NOTICE file are for informational purposes only and 209 | do not modify the License. You may add Your own attribution 210 | notices within Derivative Works that You distribute, alongside 211 | or as an addendum to the NOTICE text from the Work, provided 212 | that such additional attribution notices cannot be construed 213 | as modifying the License. 214 | 215 | You may add Your own copyright statement to Your modifications and 216 | may provide additional or different license terms and conditions 217 | for use, reproduction, or distribution of Your modifications, or 218 | for any such Derivative Works as a whole, provided Your use, 219 | reproduction, and distribution of the Work otherwise complies with 220 | the conditions stated in this License. 221 | 222 | 5. Submission of Contributions. Unless You explicitly state otherwise, 223 | any Contribution intentionally submitted for inclusion in the Work 224 | by You to the Licensor shall be under the terms and conditions of 225 | this License, without any additional terms or conditions. 226 | Notwithstanding the above, nothing herein shall supersede or modify 227 | the terms of any separate license agreement you may have executed 228 | with Licensor regarding such Contributions. 229 | 230 | 6. Trademarks. This License does not grant permission to use the trade 231 | names, trademarks, service marks, or product names of the Licensor, 232 | except as required for reasonable and customary use in describing the 233 | origin of the Work and reproducing the content of the NOTICE file. 234 | 235 | 7. Disclaimer of Warranty. Unless required by applicable law or 236 | agreed to in writing, Licensor provides the Work (and each 237 | Contributor provides its Contributions) on an "AS IS" BASIS, 238 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 239 | implied, including, without limitation, any warranties or conditions 240 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 241 | PARTICULAR PURPOSE. You are solely responsible for determining the 242 | appropriateness of using or redistributing the Work and assume any 243 | risks associated with Your exercise of permissions under this License. 244 | 245 | 8. Limitation of Liability. In no event and under no legal theory, 246 | whether in tort (including negligence), contract, or otherwise, 247 | unless required by applicable law (such as deliberate and grossly 248 | negligent acts) or agreed to in writing, shall any Contributor be 249 | liable to You for damages, including any direct, indirect, special, 250 | incidental, or consequential damages of any character arising as a 251 | result of this License or out of the use or inability to use the 252 | Work (including but not limited to damages for loss of goodwill, 253 | work stoppage, computer failure or malfunction, or any and all 254 | other commercial damages or losses), even if such Contributor 255 | has been advised of the possibility of such damages. 256 | 257 | 9. Accepting Warranty or Additional Liability. While redistributing 258 | the Work or Derivative Works thereof, You may choose to offer, 259 | and charge a fee for, acceptance of support, warranty, indemnity, 260 | or other liability obligations and/or rights consistent with this 261 | License. However, in accepting such obligations, You may act only 262 | on Your own behalf and on Your sole responsibility, not on behalf 263 | of any other Contributor, and only if You agree to indemnify, 264 | defend, and hold each Contributor harmless for any liability 265 | incurred by, or claims asserted against, such Contributor by reason 266 | of your accepting any such warranty or additional liability. 267 | 268 | END OF TERMS AND CONDITIONS 269 | 270 | APPENDIX: How to apply the Apache License to your work. 271 | 272 | To apply the Apache License to your work, attach the following 273 | boilerplate notice, with the fields enclosed by brackets "[]" 274 | replaced with your own identifying information. (Don't include 275 | the brackets!) The text should be enclosed in the appropriate 276 | comment syntax for the file format. We also recommend that a 277 | file or class name and description of purpose be included on the 278 | same "printed page" as the copyright notice for easier 279 | identification within third-party archives. 280 | 281 | Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors 282 | 283 | Licensed under the Apache License, Version 2.0 (the "License"); 284 | you may not use this file except in compliance with the License. 285 | You may obtain a copy of the License at 286 | 287 | http://www.apache.org/licenses/LICENSE-2.0 288 | 289 | Unless required by applicable law or agreed to in writing, software 290 | distributed under the License is distributed on an "AS IS" BASIS, 291 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 292 | See the License for the specific language governing permissions and 293 | limitations under the License. 294 | 295 | 296 | 297 | zone.js 298 | MIT 299 | The MIT License 300 | 301 | Copyright (c) 2016-2018 Google, Inc. 302 | 303 | Permission is hereby granted, free of charge, to any person obtaining a copy 304 | of this software and associated documentation files (the "Software"), to deal 305 | in the Software without restriction, including without limitation the rights 306 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 307 | copies of the Software, and to permit persons to whom the Software is 308 | furnished to do so, subject to the following conditions: 309 | 310 | The above copyright notice and this permission notice shall be included in 311 | all copies or substantial portions of the Software. 312 | 313 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 314 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 315 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 316 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 317 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 318 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 319 | THE SOFTWARE. 320 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <<<<<<< HEAD 6 | 7 | 8 | 9 | 10 | 11 | 12 | ======= 13 | 14 | 15 | 16 | >>>>>>> 0c19ae32b7e13676b5208b613dfb3c1ccf4f921c 17 | 18 | 23 | <<<<<<< HEAD 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ======= 59 | >>>>>>> 0c19ae32b7e13676b5208b613dfb3c1ccf4f921c 60 | 61 | 67 | 68 | 69 | 71 | <<<<<<< HEAD 72 | 73 | 96 | 97 | ======= 98 | >>>>>>> 0c19ae32b7e13676b5208b613dfb3c1ccf4f921c 99 | 100 | 104 | 105 | <<<<<<< HEAD 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 |