├── .editorconfig ├── .gitignore ├── README.md ├── data-files ├── composer-api │ ├── app.js │ ├── bin │ │ └── www │ ├── model.js │ ├── package-lock.json │ ├── package.json │ └── routes │ │ └── index.js ├── ets │ ├── ets-client │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── karma.conf.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ └── home │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ └── home.component.ts │ │ │ ├── environments │ │ │ │ ├── environment.development.ts │ │ │ │ └── environment.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ └── styles.css │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ └── ets-server │ │ ├── .gitignore │ │ ├── bin │ │ └── www │ │ ├── jsconfig copy.json │ │ ├── jsconfig.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── app.js │ │ ├── error-handler.js │ │ └── routes │ │ │ └── index.js │ │ └── test │ │ └── app.spec.js ├── gms │ ├── gms-client │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── karma.conf.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ └── home │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ └── home.component.ts │ │ │ ├── environments │ │ │ │ ├── environment.development.ts │ │ │ │ └── environment.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ └── styles.css │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ └── gms-server │ │ ├── .gitignore │ │ ├── bin │ │ └── www │ │ ├── jsconfig.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── app.js │ │ ├── error-handler.js │ │ └── routes │ │ │ └── index.js │ │ └── test │ │ ├── app.spec.js │ │ └── routes │ │ └── index.spec.js ├── hello-angular │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── app │ │ │ ├── about │ │ │ │ ├── about.component.spec.ts │ │ │ │ └── about.component.ts │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.ts │ │ │ ├── app.routes.ts │ │ │ ├── contact │ │ │ │ ├── contact.component.spec.ts │ │ │ │ └── contact.component.ts │ │ │ ├── home │ │ │ │ ├── home.component.spec.ts │ │ │ │ └── home.component.ts │ │ │ ├── layout │ │ │ │ ├── layout.component.spec.ts │ │ │ │ └── layout.component.ts │ │ │ ├── message.service.spec.ts │ │ │ ├── message.service.ts │ │ │ └── message.ts │ │ ├── index.html │ │ ├── main.ts │ │ └── styles.css │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json ├── ims │ ├── ims-client │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── karma.conf.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ └── home │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ └── home.component.ts │ │ │ ├── environments │ │ │ │ ├── environment.development.ts │ │ │ │ └── environment.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ └── styles.css │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ └── ims-server │ │ ├── .gitignore │ │ ├── bin │ │ └── www │ │ ├── jsconfig copy.json │ │ ├── jsconfig.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── app.js │ │ ├── error-handler.js │ │ └── routes │ │ │ └── index.js │ │ └── test │ │ └── app.spec.js └── tms │ ├── tms-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── app │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.ts │ │ │ ├── app.routes.ts │ │ │ └── home │ │ │ │ ├── home.component.spec.ts │ │ │ │ └── home.component.ts │ │ ├── environments │ │ │ ├── environment.development.ts │ │ │ └── environment.ts │ │ ├── index.html │ │ ├── main.ts │ │ └── styles.css │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json │ └── tms-server │ ├── .gitignore │ ├── bin │ └── www │ ├── jsconfig copy.json │ ├── jsconfig.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app.js │ ├── error-handler.js │ └── routes │ │ └── index.js │ └── test │ └── app.spec.js └── examples ├── data-samples ├── ets │ ├── categories.json │ ├── expenses.json │ └── users.json ├── gms │ ├── gardens.json │ └── plants.json ├── ims │ ├── categories.json │ ├── inventory-items.json │ └── suppliers.json └── tms │ ├── projects.json │ └── tasks.json ├── mean-dist ├── .gitignore ├── mean-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── app │ │ │ ├── about │ │ │ │ ├── about.component.spec.ts │ │ │ │ └── about.component.ts │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.ts │ │ │ ├── app.routes.ts │ │ │ ├── contact │ │ │ │ ├── contact.component.spec.ts │ │ │ │ └── contact.component.ts │ │ │ └── home │ │ │ │ ├── home.component.spec.ts │ │ │ │ └── home.component.ts │ │ ├── index.html │ │ ├── main.ts │ │ └── styles.css │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json └── mean-server │ ├── .editorconfig │ ├── app.js │ ├── bin │ └── www │ ├── package-lock.json │ ├── package.json │ ├── routes │ └── hello │ │ └── index.js │ └── utils │ └── mongo.js └── mean ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── bin └── www ├── package-lock.json ├── package.json ├── public └── favicon.ico ├── server ├── app.js ├── routes │ └── hello │ │ └── index.js └── utils │ └── mongo.js ├── src ├── app │ ├── about │ │ ├── about.component.spec.ts │ │ └── about.component.ts │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.config.ts │ ├── app.routes.ts │ ├── contact │ │ ├── contact.component.spec.ts │ │ └── contact.component.ts │ └── home │ │ ├── home.component.spec.ts │ │ └── home.component.ts ├── index.html ├── main.ts ├── proxy.conf.json └── styles.css ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json /.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 = false 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE extensions 2 | .vscode 3 | */*/.vscode 4 | .vscode/* 5 | .idea/* 6 | *.iml 7 | 8 | # node 9 | node_module 10 | .node_repl_history 11 | 12 | # macOS 13 | .DS_Store 14 | */.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [Bellevue University](http://bellevue.edu "Bellevue University is a private, non-profit university located in Bellevue, Nebraska, United States.") 2 | 3 | Address: 1000 Galvin Rd S, Bellevue, Nebraska 68005 - [Directions](https://www.google.com/maps/dir/''/Bellevue+University/@41.1509562,-95.9896355,12z/data=!4m8!4m7!1m0!1m5!1m1!1s0x8793886a86ca807f:0x838e857240d175eb!2m2!1d-95.9195956!2d41.1509774 "Google maps") 4 | 5 | Web Development [Degree](http://www.bellevue.edu/degrees/bachelor/web-development-bs/ "Designed by developers for developers.") 6 | 7 | # WEB 450 Mastering the MEAN Stack Bootcamp 8 | 9 | ### Course Description 10 | This course is an immersive web development bootcamp. It is a full stack experience using the skills previously developed in languages, APIs, and frameworks. This course pulls it all together in a more difficult and highly demanding environment. Topics include UI considerations, web services, server-side scripting, and database development and use. Security and unit testing are also covered. GitHub is used to host coding projects. The course is synchronous with all students participating two nights a week for 9 consecutive weeks. 11 | 12 | ### Course Prerequisites 13 | WEB 200, WEB 231, WEB 330, WEB 340, WEB 420, and WEB 425 14 | 15 | ### Course Objectives 16 | Students who successfully complete this course should be able to: 17 | - Examine the components of full stack web applications 18 | - Defend the ue of source control environments 19 | - Evaluate strategies for team collaboration 20 | - Justify design choices for web projects 21 | - Test for vulnerabilities in web applications 22 | - Build a full stack web application 23 | 24 | ### Topic Outline 25 |
    26 |
  1. 27 | Full Stack Development Fundamentals 28 |
      29 |
    1. MEAN Stack Overview
    2. 30 |
    3. Development Environment Setup
    4. 31 |
    5. Source Control with GitHub
    6. 32 |
    7. Security Best Practices
    8. 33 |
    34 |
  2. 35 |
  3. 36 | Web Application Development 37 |
      38 |
    1. Frontend and Backend Integration
    2. 39 |
    3. API Development
    4. 40 |
    5. User Interface Design
    6. 41 |
    7. Database Management
    8. 42 |
    43 |
  4. 44 |
  5. 45 | Collaboration and Testing 46 |
      47 |
    1. Team Collaboration Strategies
    2. 48 |
    3. Code Review Practices
    4. 49 |
    5. Pair Programming
    6. 50 |
    7. Unit Testing
    8. 51 |
    9. Deployment
    10. 52 |
    53 |
  6. 54 |
55 | 56 | 57 | ## Repository Overview 58 | The courses repository consist of two directories: data-files and examples. The data-files directory contains starter projects for the course's textbook and group projects. The examples directory contains example projects that will be covered during class. 59 | 60 | ```bash 61 | git clone https://github.com/buwebdev/web-450.git 62 | cd web-450 63 | ``` -------------------------------------------------------------------------------- /data-files/composer-api/app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var path = require('path'); 3 | var cookieParser = require('cookie-parser'); 4 | var logger = require('morgan'); 5 | const createError = require('http-errors'); 6 | 7 | var indexRouter = require('./routes/index'); 8 | 9 | var app = express(); 10 | 11 | app.use(logger('dev')); 12 | app.use(express.json()); 13 | app.use(express.urlencoded({ extended: false })); 14 | app.use(cookieParser()); 15 | app.use(express.static(path.join(__dirname, 'public'))); 16 | 17 | app.use('/api/composers', indexRouter); 18 | 19 | app.use((req, res, next) => { 20 | next(createError(404)); 21 | }) 22 | 23 | app.use((err, req, res, next) => { 24 | res.status(err.status || 500); 25 | 26 | res.json({ 27 | type: 'error', 28 | status: res.status, 29 | message: err.message, 30 | stack: req.app.get('env') === 'development' ? err.stack : undefined 31 | }) 32 | }); 33 | 34 | module.exports = app; 35 | -------------------------------------------------------------------------------- /data-files/composer-api/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('composer-api:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /data-files/composer-api/model.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | composerService: createComposerService() 3 | } 4 | 5 | function createComposerService() { 6 | const database = { 7 | 1: { firstName: 'Johann', lastName: 'Bach', genre: 'Baroque' }, 8 | 2: { firstName: 'Ludwig', lastName: 'Beethoven', genre: 'Classical' }, 9 | 3: { firstName: 'Richard', lastName: 'Wagner', genre: 'Romantic' }, 10 | 4: { firstName: 'Philip', lastName: 'Glass', genre: 'Contemporary' } 11 | } 12 | 13 | return { 14 | getAllComposers, 15 | getComposerById, 16 | addComposer, 17 | modifyComposer, 18 | deleteComposer, 19 | } 20 | 21 | // Retrieve all composers from the database 22 | async function getAllComposers() { 23 | return database; 24 | } 25 | 26 | // Retrieve a specific composer by ID 27 | async function getComposerById(id) { 28 | if (!database.hasOwnProperty(id)) { 29 | throw new Error('Composer not found in the database'); 30 | } 31 | return database[id]; 32 | } 33 | 34 | // Add a new composer to the database 35 | async function addComposer(id, data) { 36 | if (database.hasOwnProperty(id)) { 37 | throw new Error('Composer with this ID already exists'); 38 | } 39 | database[id] = data; 40 | return id; 41 | } 42 | 43 | // Update an existing composer in the database 44 | async function modifyComposer(id, data) { 45 | if (!database.hasOwnProperty(id)) { 46 | throw new Error('Composer not found in the database'); 47 | } 48 | database[id] = data; 49 | return id; 50 | } 51 | 52 | // Delete a composer from the database 53 | async function deleteComposer(id) { 54 | if (!database.hasOwnProperty(id)) { 55 | throw new Error('Composer not found in the database'); 56 | } 57 | delete database[id]; 58 | return id; 59 | } 60 | } -------------------------------------------------------------------------------- /data-files/composer-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "composer-api", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "cookie-parser": "~1.4.4", 10 | "debug": "~2.6.9", 11 | "express": "~4.16.1", 12 | "http-errors": "^2.0.0", 13 | "morgan": "~1.9.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /data-files/composer-api/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | const { composerService } = require('../model'); 4 | const createError = require('http-errors'); 5 | 6 | router.get('/', async function(req, res, next) { 7 | try { 8 | const composers = await composerService.getAllComposers(); 9 | res.json(composers); 10 | } catch (err) { 11 | console.error(err); 12 | next(err); 13 | } 14 | }); 15 | 16 | router.get('/:id', async function(req, res, next) { 17 | try { 18 | const composer = await composerService.getComposerById(req.params.id); 19 | res.json(composer); 20 | } catch (err) { 21 | console.error(err); 22 | next(err); 23 | } 24 | }); 25 | 26 | router.put('/:id', async function(req, res, next) { 27 | try { 28 | const id = await composerService.modifyComposer(req.params.id, req.body); 29 | res.json({ id }); 30 | } catch (err) { 31 | console.error(err); 32 | if (err.message === 'Composer not found in the database') { 33 | return next(createError(404, err.message)); 34 | } 35 | next(err); 36 | } 37 | }); 38 | 39 | router.post('/', async function(req, res, next) { 40 | try { 41 | const composer = { 42 | firstName: req.body.data.firstName, 43 | lastName: req.body.data.lastName, 44 | genre: req.body.data.genre, 45 | } 46 | 47 | const id = await composerService.addComposer(req.body.id, composer); 48 | 49 | res.json({ 50 | id: id 51 | }) 52 | } catch (err) { 53 | console.error(err); 54 | if (err.message === 'Composer with this ID already exists') { 55 | return next(createError(409, err.message)); 56 | } 57 | next(err); 58 | } 59 | }); 60 | 61 | router.delete('/:id', async function(req, res, next) { 62 | try { 63 | const id = await composerService.deleteComposer(req.params.id); 64 | res.json({ id }); 65 | } catch (err) { 66 | console.error(err); 67 | if (err.message === 'Composer not found in the database') { 68 | return next(createError(404, err.message)); 69 | } 70 | next(err); 71 | } 72 | }); 73 | 74 | module.exports = router; 75 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/README.md: -------------------------------------------------------------------------------- 1 | # EtsClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ets-client": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/ets-client", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.development.ts" 58 | } 59 | ] 60 | } 61 | }, 62 | "defaultConfiguration": "production" 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "configurations": { 67 | "production": { 68 | "buildTarget": "ets-client:build:production" 69 | }, 70 | "development": { 71 | "buildTarget": "ets-client:build:development" 72 | } 73 | }, 74 | "defaultConfiguration": "development" 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n" 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "polyfills": [ 83 | "zone.js", 84 | "zone.js/testing" 85 | ], 86 | "tsConfig": "tsconfig.spec.json", 87 | "assets": [ 88 | { 89 | "glob": "**/*", 90 | "input": "public" 91 | } 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [], 97 | "karmaConfig": "karma.conf.js" 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/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-firefox-launcher'), 10 | require('karma-jasmine'), 11 | require('karma-chrome-launcher'), 12 | require('karma-jasmine-html-reporter'), 13 | require('karma-coverage'), 14 | require('@angular-devkit/build-angular/plugins/karma') 15 | ], 16 | client: { 17 | jasmine: { 18 | // you can add configuration options for Jasmine here 19 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 20 | // for example, you can disable the random execution with `random: false` 21 | // or set a specific seed with `seed: 4321` 22 | }, 23 | clearContext: false // leave Jasmine Spec Runner output visible in browser 24 | }, 25 | jasmineHtmlReporter: { 26 | suppressAll: true // removes the duplicated traces 27 | }, 28 | coverageReporter: { 29 | dir: require('path').join(__dirname, './coverage/ets-client'), 30 | subdir: '.', 31 | reporters: [ 32 | { type: 'html' }, 33 | { type: 'text-summary' } 34 | ] 35 | }, 36 | reporters: ['progress', 'kjhtml'], 37 | browsers: ['Firefox'], 38 | restartOnFileChange: true 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ets-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-firefox-launcher": "^2.1.3", 35 | "karma-jasmine": "~5.1.0", 36 | "karma-jasmine-html-reporter": "~2.1.0", 37 | "typescript": "~5.4.2" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/data-files/ets/ets-client/public/favicon.ico -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'ets-client' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('ets-client'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to the MEAN Stack Starter Project'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet], 8 | template: ` 9 |
10 |
11 |

Welcome to the MEAN Stack Starter Project

12 |
13 | 20 |
21 |
22 | 23 |
24 |
25 | 28 |
29 | `, 30 | styles: ` 31 | .container { 32 | display: flex; 33 | flex-direction: column; 34 | min-height: 100vh; 35 | text-align: center; 36 | padding: 0; 37 | margin: 0 auto; 38 | } 39 | 40 | header, footer { 41 | background-color: #f8f9fa; 42 | padding: 10px 0; 43 | } 44 | 45 | nav ul { 46 | list-style-type: none; 47 | padding: 0; 48 | } 49 | 50 | nav ul li { 51 | display: inline; 52 | margin-right: 10px; 53 | } 54 | 55 | main { 56 | flex: 1; 57 | } 58 | ` 59 | }) 60 | export class AppComponent { 61 | title = 'ets-client'; 62 | } 63 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | import { provideHttpClient } from '@angular/common/http'; 6 | 7 | export const appConfig: ApplicationConfig = { 8 | providers: [ 9 | provideZoneChangeDetection({ eventCoalescing: true }), 10 | provideRouter(routes), 11 | provideHttpClient() 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | 4 | export const routes: Routes = [ 5 | { 6 | path: '', 7 | component: HomeComponent 8 | } 9 | ]; 10 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | let httpTestingController: HttpTestingController; 9 | 10 | beforeEach(async () => { 11 | await TestBed.configureTestingModule({ 12 | imports: [HomeComponent, HttpClientTestingModule] 13 | }) 14 | .compileComponents(); 15 | 16 | httpTestingController = TestBed.inject(HttpTestingController); 17 | 18 | fixture = TestBed.createComponent(HomeComponent); 19 | component = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('should create', () => { 24 | expect(component).toBeTruthy(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { environment } from '../../environments/environment'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |

Main Content

11 |

This is a basic layout for your MEAN stack project.

12 |

Server message: {{ serverMessage }}

13 | `, 14 | styles: `` 15 | }) 16 | export class HomeComponent { 17 | serverMessage: string; 18 | 19 | constructor(private http: HttpClient) { 20 | this.serverMessage = ''; 21 | 22 | // Simulate a server request that takes 2 seconds to complete 23 | setTimeout(() => { 24 | this.http.get(`${environment.apiBaseUrl}/api`).subscribe({ 25 | next: (res: any) => { 26 | this.serverMessage = res['message']; 27 | }, 28 | error: (err) => { 29 | this.serverMessage = 'Error loading server message'; 30 | } 31 | }); 32 | }, 2000); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/environments/environment.development.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: false, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EtsClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | height: 100%; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /data-files/ets/ets-client/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/.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 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../src/app'); 8 | var debug = require('debug')('ets-server:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/jsconfig copy.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/ets/ets-server/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/ets/ets-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ets-server", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www", 7 | "dev": "nodemon ./bin/www", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "ajv": "^8.17.1", 12 | "cookie-parser": "~1.4.4", 13 | "debug": "~2.6.9", 14 | "express": "~4.16.1", 15 | "http-errors": "^2.0.0", 16 | "morgan": "~1.9.1" 17 | }, 18 | "devDependencies": { 19 | "@types/jest": "^29.5.12", 20 | "jest": "^29.7.0", 21 | "nodemon": "^3.1.4", 22 | "supertest": "^7.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/src/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.js 5 | * Description: Application setup. Autogenerated using Express generator. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const cookieParser = require('cookie-parser'); 11 | const logger = require('morgan'); 12 | const { notFoundHandler, errorHandler } = require('./error-handler'); 13 | 14 | // Importing the index router 15 | const indexRouter = require('./routes/index'); 16 | 17 | // Variable declaration for the express app 18 | let app = express(); 19 | 20 | // CORS configuration 21 | app.use((req, res, next) => { 22 | res.setHeader('Access-Control-Allow-Origin', '*'); // This allows all origins 23 | res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed request methods 24 | res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // Allowed headers 25 | next(); 26 | }); 27 | 28 | // Express app configuration 29 | app.use(logger('dev')); 30 | app.use(express.json()); 31 | app.use(express.urlencoded({ extended: false })); 32 | app.use(cookieParser()); 33 | 34 | // Routing configuration 35 | app.use('/api', indexRouter); 36 | 37 | // Use the error handling middleware 38 | app.use(notFoundHandler); 39 | app.use(errorHandler); 40 | 41 | // Export the app 42 | module.exports = app; 43 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/src/error-handler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: error-handler.js 5 | * Description: Error handling middleware functions. 6 | */ 7 | 8 | // Require statements 9 | const createError = require('http-errors'); 10 | 11 | /** 12 | * @description 13 | * Middleware function for handling 404 errors in an Express application. 14 | * 15 | * This middleware catches any requests that do not match any routes and creates 16 | * a 404 Not Found error. The error is then passed to the next middleware function 17 | * for further handling. 18 | * 19 | * Usage: 20 | * 21 | * app.use(notFoundHandler); 22 | * 23 | * Example: 24 | * 25 | * // Define routes 26 | * app.get('/example', (req, res) => { 27 | * res.send('Example route'); 28 | * }); 29 | * 30 | * // 404 error handling middleware 31 | * app.use(notFoundHandler); 32 | * 33 | * In this example, if a request is made to a route that does not exist, the 34 | * notFoundHandler middleware will create a 404 Not Found error and pass it to 35 | * the next middleware function. 36 | */ 37 | const notFoundHandler = (req, res, next) => { 38 | const error = createError(404, 'Not Found'); 39 | next(error); 40 | }; 41 | 42 | /** 43 | * @description 44 | * Middleware function for handling errors in an Express application. 45 | * 46 | * This middleware catches any errors that occur during the request-response cycle 47 | * and sends a JSON response with the error details. The response includes the error 48 | * type, status, message, and stack trace (if in development mode). 49 | * 50 | * Usage: 51 | * 52 | * app.use(errorHandler); 53 | * 54 | * Example: 55 | * 56 | * // Define routes 57 | * app.get('/example', (req, res) => { 58 | * throw new Error('Example error'); 59 | * }); 60 | * 61 | * // Error handling middleware 62 | * app.use(errorHandler); 63 | * 64 | * In this example, if an error occurs in the '/example' route, the error handling 65 | * middleware will catch it and send a JSON response with the error details. 66 | */ 67 | const errorHandler = (err, req, res, next) => { 68 | res.status(err.status || 500); 69 | res.json({ 70 | type: 'error', 71 | status: err.status, 72 | message: err.message, 73 | stack: req.app.get('env') === 'development' ? err.stack : undefined 74 | }); 75 | } 76 | 77 | // Export the middleware functions 78 | module.exports = { 79 | notFoundHandler, 80 | errorHandler 81 | }; -------------------------------------------------------------------------------- /data-files/ets/ets-server/src/routes/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: index.js 5 | * Description: Routing for the index page. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const router = express.Router(); 11 | 12 | /** 13 | * @description 14 | * Route handler for the root path ('/'). 15 | * 16 | * This route responds with a JSON message when accessed. 17 | * 18 | * Usage: 19 | * 20 | * router.get('/', function(req, res, next) { 21 | * res.send({ 22 | * message: 'Hello from the ETS server!' 23 | * }); 24 | * }); 25 | * 26 | * Example: 27 | * 28 | * // Accessing the root path 29 | * // GET http:/// 30 | * 31 | * // Response: 32 | * // { 33 | * // "message": "Hello from the ETS server!" 34 | * // } 35 | */ 36 | router.get('/', function(req, res, next) { 37 | const appName = 'Expense Tracking System'; 38 | res.send({ 39 | message: `Hello from the ${appName} server!` 40 | }); 41 | }); 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /data-files/ets/ets-server/test/app.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.spec.js 5 | * Description: Test file for the Express application setup. 6 | */ 7 | 8 | // Require statements 9 | const request = require('supertest'); 10 | const express = require('express'); 11 | const app = require('../src/app'); 12 | const { errorHandler } = require('../src/error-handler'); 13 | 14 | // Test cases 15 | describe('app.js', () => { 16 | // Test the CORS configuration 17 | it('should set CORS headers', async () => { 18 | const response = await request(app).get('/api'); 19 | expect(response.headers['access-control-allow-origin']).toBe('*'); 20 | expect(response.headers['access-control-allow-methods']).toBe('GET, POST, PUT, DELETE, OPTIONS'); 21 | expect(response.headers['access-control-allow-headers']).toBe('Origin, X-Requested-With, Content-Type, Accept'); 22 | }); 23 | 24 | // Test the 500 error handler 25 | it('should handle 500 errors and return appropriate response', async () => { 26 | // Create a new instance of the app for testing 27 | const testApp = express(); 28 | 29 | // Define a route that throws an error 30 | testApp.get('/error', (req, res, next) => { 31 | const error = new Error('Test error'); 32 | error.status = 500; 33 | next(error); 34 | }); 35 | 36 | // Use the error handling middleware directly 37 | testApp.use(errorHandler); 38 | 39 | const response = await request(testApp).get('/error'); 40 | expect(response.status).toBe(500); 41 | expect(response.body).toEqual(expect.objectContaining({ 42 | type: 'error', 43 | status: 500, 44 | message: 'Test error' 45 | })); 46 | }); 47 | 48 | // Test the 404 error handler 49 | it('should return 404 for undefined routes', async () => { 50 | const response = await request(app).get('/undefined-route'); 51 | expect(response.status).toBe(404); 52 | expect(response.body).toEqual(expect.objectContaining({ 53 | type: 'error', 54 | status: 404, 55 | message: 'Not Found' 56 | })); 57 | }); 58 | }); -------------------------------------------------------------------------------- /data-files/gms/gms-client/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/README.md: -------------------------------------------------------------------------------- 1 | # TmsClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "gms-client": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/gms-client", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.development.ts" 58 | } 59 | ] 60 | } 61 | }, 62 | "defaultConfiguration": "production" 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "configurations": { 67 | "production": { 68 | "buildTarget": "gms-client:build:production" 69 | }, 70 | "development": { 71 | "buildTarget": "gms-client:build:development" 72 | } 73 | }, 74 | "defaultConfiguration": "development" 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n" 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "polyfills": [ 83 | "zone.js", 84 | "zone.js/testing" 85 | ], 86 | "tsConfig": "tsconfig.spec.json", 87 | "assets": [ 88 | { 89 | "glob": "**/*", 90 | "input": "public" 91 | } 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [], 97 | "karmaConfig": "karma.conf.js" 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/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-firefox-launcher'), 10 | require('karma-jasmine'), 11 | require('karma-chrome-launcher'), 12 | require('karma-jasmine-html-reporter'), 13 | require('karma-coverage'), 14 | require('@angular-devkit/build-angular/plugins/karma') 15 | ], 16 | client: { 17 | jasmine: { 18 | // you can add configuration options for Jasmine here 19 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 20 | // for example, you can disable the random execution with `random: false` 21 | // or set a specific seed with `seed: 4321` 22 | }, 23 | clearContext: false // leave Jasmine Spec Runner output visible in browser 24 | }, 25 | jasmineHtmlReporter: { 26 | suppressAll: true // removes the duplicated traces 27 | }, 28 | coverageReporter: { 29 | dir: require('path').join(__dirname, './coverage/ets-client'), 30 | subdir: '.', 31 | reporters: [ 32 | { type: 'html' }, 33 | { type: 'text-summary' } 34 | ] 35 | }, 36 | reporters: ['progress', 'kjhtml'], 37 | browsers: ['Firefox'], 38 | restartOnFileChange: true 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gms-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-firefox-launcher": "^2.1.3", 35 | "karma-jasmine": "~5.1.0", 36 | "karma-jasmine-html-reporter": "~2.1.0", 37 | "typescript": "~5.4.2" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/data-files/gms/gms-client/public/favicon.ico -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'ets-client' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('ets-client'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to the MEAN Stack Starter Project'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet], 8 | template: ` 9 |
10 |
11 |

Welcome to the MEAN Stack Starter Project

12 |
13 | 20 |
21 |
22 | 23 |
24 |
25 |
26 |

© 2024 MEAN Stack Project

27 |
28 |
29 | `, 30 | styles: ` 31 | .container { 32 | display: flex; 33 | flex-direction: column; 34 | min-height: 100vh; 35 | text-align: center; 36 | padding: 0; 37 | margin: 0 auto; 38 | } 39 | 40 | header, footer { 41 | background-color: #f8f9fa; 42 | padding: 10px 0; 43 | } 44 | 45 | nav ul { 46 | list-style-type: none; 47 | padding: 0; 48 | } 49 | 50 | nav ul li { 51 | display: inline; 52 | margin-right: 10px; 53 | } 54 | 55 | main { 56 | flex: 1; 57 | } 58 | ` 59 | }) 60 | export class AppComponent { 61 | title = 'ets-client'; 62 | } 63 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | import { provideHttpClient } from '@angular/common/http'; 6 | 7 | export const appConfig: ApplicationConfig = { 8 | providers: [ 9 | provideZoneChangeDetection({ eventCoalescing: true }), 10 | provideRouter(routes), 11 | provideHttpClient() 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | 4 | export const routes: Routes = [ 5 | { 6 | path: '', 7 | component: HomeComponent 8 | } 9 | ]; 10 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 3 | import { HomeComponent } from './home.component'; 4 | import { environment } from '../../environments/environment'; 5 | 6 | describe('HomeComponent', () => { 7 | let component: HomeComponent; 8 | let fixture: ComponentFixture; 9 | let httpTestingController: HttpTestingController; 10 | 11 | beforeEach(async () => { 12 | await TestBed.configureTestingModule({ 13 | imports: [HomeComponent, HttpClientTestingModule] 14 | }) 15 | .compileComponents(); 16 | 17 | httpTestingController = TestBed.inject(HttpTestingController); 18 | 19 | fixture = TestBed.createComponent(HomeComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { environment } from '../../environments/environment'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |

Main Content

11 |

This is a basic layout for your MEAN stack project.

12 |

Server message: {{ serverMessage }}

13 | `, 14 | styles: `` 15 | }) 16 | export class HomeComponent { 17 | serverMessage: string; 18 | 19 | constructor(private http: HttpClient) { 20 | this.serverMessage = ''; 21 | 22 | // Simulate a server request that takes 2 seconds to complete 23 | setTimeout(() => { 24 | this.http.get(`${environment.apiBaseUrl}/api`).subscribe({ 25 | next: (res: any) => { 26 | this.serverMessage = res['message']; 27 | }, 28 | error: (err) => { 29 | this.serverMessage = 'Error loading server message'; 30 | } 31 | }); 32 | }, 2000); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/environments/environment.development.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: false, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TmsClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | height: 100%; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /data-files/gms/gms-client/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/.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 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../src/app'); 8 | var debug = require('debug')('ets-server:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/gms/gms-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gms-server", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www", 7 | "dev": "nodemon ./bin/www", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "ajv": "^8.17.1", 12 | "cookie-parser": "~1.4.4", 13 | "debug": "~2.6.9", 14 | "express": "~4.16.1", 15 | "http-errors": "^2.0.0", 16 | "mongoose": "^8.6.0", 17 | "morgan": "~1.9.1" 18 | }, 19 | "devDependencies": { 20 | "@types/jest": "^29.5.12", 21 | "jest": "^29.7.0", 22 | "nodemon": "^3.1.4", 23 | "supertest": "^7.0.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/src/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.js 5 | * Description: Application setup. Autogenerated using Express generator. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const createError = require('http-errors'); 11 | const cookieParser = require('cookie-parser'); 12 | const logger = require('morgan'); 13 | const { notFoundHandler, errorHandler } = require('./error-handler'); 14 | 15 | // Importing the index router 16 | const indexRouter = require('./routes/index'); 17 | 18 | // Variable declaration for the express app 19 | let app = express(); 20 | 21 | // CORS configuration 22 | app.use((req, res, next) => { 23 | res.setHeader('Access-Control-Allow-Origin', '*'); // This allows all origins 24 | res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed request methods 25 | res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // Allowed headers 26 | next(); 27 | }); 28 | 29 | // Express app configuration 30 | app.use(logger('dev')); 31 | app.use(express.json()); 32 | app.use(express.urlencoded({ extended: false })); 33 | app.use(cookieParser()); 34 | 35 | // Routing configuration 36 | app.use('/api', indexRouter); 37 | 38 | // Use the error handling middleware 39 | app.use(notFoundHandler); 40 | app.use(errorHandler); 41 | 42 | // Export the app 43 | module.exports = app; 44 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/src/error-handler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: error-handler.js 5 | * Description: Error handling middleware functions. 6 | */ 7 | 8 | // Require statements 9 | const createError = require('http-errors'); 10 | 11 | /** 12 | * @description 13 | * Middleware function for handling 404 errors in an Express application. 14 | * 15 | * This middleware catches any requests that do not match any routes and creates 16 | * a 404 Not Found error. The error is then passed to the next middleware function 17 | * for further handling. 18 | * 19 | * Usage: 20 | * 21 | * app.use(notFoundHandler); 22 | * 23 | * Example: 24 | * 25 | * // Define routes 26 | * app.get('/example', (req, res) => { 27 | * res.send('Example route'); 28 | * }); 29 | * 30 | * // 404 error handling middleware 31 | * app.use(notFoundHandler); 32 | * 33 | * In this example, if a request is made to a route that does not exist, the 34 | * notFoundHandler middleware will create a 404 Not Found error and pass it to 35 | * the next middleware function. 36 | */ 37 | const notFoundHandler = (req, res, next) => { 38 | const error = createError(404, 'Not Found'); 39 | next(error); 40 | }; 41 | 42 | /** 43 | * @description 44 | * Middleware function for handling errors in an Express application. 45 | * 46 | * This middleware catches any errors that occur during the request-response cycle 47 | * and sends a JSON response with the error details. The response includes the error 48 | * type, status, message, and stack trace (if in development mode). 49 | * 50 | * Usage: 51 | * 52 | * app.use(errorHandler); 53 | * 54 | * Example: 55 | * 56 | * // Define routes 57 | * app.get('/example', (req, res) => { 58 | * throw new Error('Example error'); 59 | * }); 60 | * 61 | * // Error handling middleware 62 | * app.use(errorHandler); 63 | * 64 | * In this example, if an error occurs in the '/example' route, the error handling 65 | * middleware will catch it and send a JSON response with the error details. 66 | */ 67 | const errorHandler = (err, req, res, next) => { 68 | res.status(err.status || 500); 69 | res.json({ 70 | type: 'error', 71 | status: err.status, 72 | message: err.message, 73 | stack: req.app.get('env') === 'development' ? err.stack : undefined 74 | }); 75 | } 76 | 77 | // Export the middleware functions 78 | module.exports = { 79 | notFoundHandler, 80 | errorHandler 81 | }; -------------------------------------------------------------------------------- /data-files/gms/gms-server/src/routes/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: index.js 5 | * Description: Routing for the index page. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const router = express.Router(); 11 | 12 | /** 13 | * @description 14 | * Route handler for the root path ('/'). 15 | * 16 | * This route responds with a JSON message when accessed. 17 | * 18 | * Usage: 19 | * 20 | * router.get('/', function(req, res, next) { 21 | * res.send({ 22 | * message: 'Hello from the ETS server!' 23 | * }); 24 | * }); 25 | * 26 | * Example: 27 | * 28 | * // Accessing the root path 29 | * // GET http:/// 30 | * 31 | * // Response: 32 | * // { 33 | * // "message": "Hello from the ETS server!" 34 | * // } 35 | */ 36 | router.get('/', function(req, res, next) { 37 | const appName = 'Gardening Management System'; 38 | res.send({ 39 | message: `Hello from the ${appName} server!` 40 | }); 41 | }); 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /data-files/gms/gms-server/test/app.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.spec.js 5 | * Description: Test file for the Express application setup. 6 | */ 7 | 8 | // Require statements 9 | const request = require('supertest'); 10 | const express = require('express'); 11 | const app = require('../src/app'); 12 | const { errorHandler } = require('../src/error-handler'); 13 | 14 | // Test cases 15 | describe('app.js', () => { 16 | // Test the CORS configuration 17 | it('should set CORS headers', async () => { 18 | const response = await request(app).get('/api'); 19 | expect(response.headers['access-control-allow-origin']).toBe('*'); 20 | expect(response.headers['access-control-allow-methods']).toBe('GET, POST, PUT, DELETE, OPTIONS'); 21 | expect(response.headers['access-control-allow-headers']).toBe('Origin, X-Requested-With, Content-Type, Accept'); 22 | }); 23 | 24 | // Test the 500 error handler 25 | it('should handle 500 errors and return appropriate response', async () => { 26 | // Create a new instance of the app for testing 27 | const testApp = express(); 28 | 29 | // Define a route that throws an error 30 | testApp.get('/error', (req, res, next) => { 31 | const error = new Error('Test error'); 32 | error.status = 500; 33 | next(error); 34 | }); 35 | 36 | // Use the error handling middleware directly 37 | testApp.use(errorHandler); 38 | 39 | const response = await request(testApp).get('/error'); 40 | expect(response.status).toBe(500); 41 | expect(response.body).toEqual(expect.objectContaining({ 42 | type: 'error', 43 | status: 500, 44 | message: 'Test error' 45 | })); 46 | }); 47 | 48 | // Test the 404 error handler 49 | it('should return 404 for undefined routes', async () => { 50 | const response = await request(app).get('/undefined-route'); 51 | expect(response.status).toBe(404); 52 | expect(response.body).toEqual(expect.objectContaining({ 53 | type: 'error', 54 | status: 404, 55 | message: 'Not Found' 56 | })); 57 | }); 58 | }); -------------------------------------------------------------------------------- /data-files/gms/gms-server/test/routes/index.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Modified by: GitHub Copilot 4 | * Date: 2 September 2024 5 | * File: index.spec.js 6 | * Description: Test the index route. 7 | */ 8 | const request = require('supertest'); 9 | const express = require('express'); 10 | const router = require('../../src/app'); 11 | 12 | // Create an instance of the Express app 13 | const app = express(); 14 | app.use('/', router); 15 | 16 | describe('GET /api', () => { 17 | it('should return status 200', async () => { 18 | const response = await request(app).get('/api'); 19 | expect(response.status).toBe(200); 20 | }); 21 | 22 | it('should return a JSON response', async () => { 23 | const response = await request(app).get('/api'); 24 | expect(response.headers['content-type']).toMatch(/json/); 25 | }); 26 | 27 | it('should return the correct message', async () => { 28 | const response = await request(app).get('/api'); 29 | expect(response.body).toHaveProperty('message', 'Hello from the Gardening Management System server!'); 30 | }); 31 | }); -------------------------------------------------------------------------------- /data-files/hello-angular/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /data-files/hello-angular/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /data-files/hello-angular/README.md: -------------------------------------------------------------------------------- 1 | # HelloAngular 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /data-files/hello-angular/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "hello-angular": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/hello-angular", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true 54 | } 55 | }, 56 | "defaultConfiguration": "production" 57 | }, 58 | "serve": { 59 | "builder": "@angular-devkit/build-angular:dev-server", 60 | "configurations": { 61 | "production": { 62 | "buildTarget": "hello-angular:build:production" 63 | }, 64 | "development": { 65 | "buildTarget": "hello-angular:build:development" 66 | } 67 | }, 68 | "defaultConfiguration": "development" 69 | }, 70 | "extract-i18n": { 71 | "builder": "@angular-devkit/build-angular:extract-i18n" 72 | }, 73 | "test": { 74 | "builder": "@angular-devkit/build-angular:karma", 75 | "options": { 76 | "polyfills": [ 77 | "zone.js", 78 | "zone.js/testing" 79 | ], 80 | "tsConfig": "tsconfig.spec.json", 81 | "assets": [ 82 | { 83 | "glob": "**/*", 84 | "input": "public" 85 | } 86 | ], 87 | "styles": [ 88 | "src/styles.css" 89 | ], 90 | "scripts": [] 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /data-files/hello-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-angular", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-jasmine": "~5.1.0", 35 | "karma-jasmine-html-reporter": "~2.1.0", 36 | "typescript": "~5.4.2" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /data-files/hello-angular/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/data-files/hello-angular/public/favicon.ico -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/about/about.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AboutComponent } from './about.component'; 4 | 5 | describe('AboutComponent', () => { 6 | let component: AboutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [AboutComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(AboutComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Message } from '../message'; 3 | import { MessageService } from '../message.service'; 4 | 5 | @Component({ 6 | selector: 'app-about', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |
11 |

{{ message.title }}

12 |

{{ message.content }}

13 |
14 | `, 15 | styles: `` 16 | }) 17 | export class AboutComponent { 18 | message: Message; 19 | 20 | constructor(private messageService: MessageService) { 21 | this.message = this.messageService.getMessageById(2) || {} as Message; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'hello-angular' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('hello-angular'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Hello, hello-angular'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet], 8 | template: ``, 9 | styles: `` 10 | }) 11 | export class AppComponent { 12 | title = 'hello-angular'; 13 | } 14 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | 6 | export const appConfig: ApplicationConfig = { 7 | providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)] 8 | }; 9 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { LayoutComponent } from './layout/layout.component'; 3 | import { HomeComponent } from './home/home.component'; 4 | import { AboutComponent } from './about/about.component'; 5 | import { ContactComponent } from './contact/contact.component'; 6 | 7 | export const routes: Routes = [ 8 | { 9 | path: '', 10 | component: LayoutComponent, 11 | children: [ 12 | { 13 | path: '', 14 | component: HomeComponent 15 | }, 16 | { 17 | path: 'about', 18 | component: AboutComponent 19 | }, 20 | { 21 | path: 'contact', 22 | component: ContactComponent 23 | } 24 | ] 25 | } 26 | ]; 27 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/contact/contact.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ContactComponent } from './contact.component'; 4 | 5 | describe('ContactComponent', () => { 6 | let component: ContactComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [ContactComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(ContactComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/contact/contact.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Message } from '../message'; 3 | import { MessageService } from '../message.service'; 4 | import { CommonModule } from '@angular/common'; 5 | 6 | @Component({ 7 | selector: 'app-contact', 8 | standalone: true, 9 | imports: [CommonModule], 10 | template: ` 11 | @if (messages.length > 0) { 12 |
13 |
    14 | @for (message of messages; track message) { 15 |
  • 16 |

    {{ message.title }}

    17 |

    {{ message.content }}

    18 |
  • 19 | } 20 |
21 |
22 | } @else { 23 |
24 |

No messages available

25 |
26 | } 27 | `, 28 | styles: ` 29 | .highlight { 30 | font-weight: bold; 31 | color: red; 32 | } 33 | ` 34 | }) 35 | export class ContactComponent { 36 | messages: Message[]; 37 | 38 | constructor(private messageService: MessageService) { 39 | this.messages = this.messageService.getMessages(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [HomeComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(HomeComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Message } from '../message'; 3 | import { MessageService } from '../message.service'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |
11 |

{{ message.title }}

12 |

{{ message.content }}

13 |
14 | `, 15 | styles: `` 16 | }) 17 | export class HomeComponent { 18 | message: Message; 19 | 20 | constructor(private messageService: MessageService) { 21 | this.message = this.messageService.getMessageById(1) || {} as Message; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/layout/layout.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LayoutComponent } from './layout.component'; 4 | 5 | describe('LayoutComponent', () => { 6 | let component: LayoutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [LayoutComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(LayoutComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/layout/layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet, RouterLink } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-layout', 6 | standalone: true, 7 | imports: [RouterLink, RouterOutlet], 8 | template: ` 9 |
10 |
11 |
12 |

Hello Angular

13 | 18 |
19 |
20 |
21 | 22 |
23 |
24 | 32 |
33 |
34 | `, 35 | styles: [` 36 | .bg-dark { 37 | background-color: #343a40; 38 | } 39 | .text-light { 40 | color: #f8f9fa; 41 | } 42 | .container { 43 | max-width: 1140px; 44 | margin: 0 auto; 45 | padding: 0 15px; 46 | } 47 | .layout__header, .layout__footer { 48 | padding: 1rem 0; 49 | } 50 | .layout__header-container { 51 | display: flex; 52 | justify-content: space-between; 53 | align-items: center; 54 | } 55 | .layout__title { 56 | margin: 0; 57 | font-size: 1.5rem; 58 | } 59 | .layout__nav, .layout__footer-nav { 60 | display: flex; 61 | gap: 1rem; 62 | } 63 | .layout__link { 64 | color: #f8f9fa; 65 | text-decoration: none; 66 | } 67 | .layout__link:hover { 68 | text-decoration: underline; 69 | } 70 | .layout__main { 71 | padding: 2rem 15px; 72 | flex: 1; 73 | } 74 | .layout__footer { 75 | text-align: center; 76 | } 77 | .layout__footer-container { 78 | display: flex; 79 | flex-direction: column; 80 | align-items: center; 81 | } 82 | .layout__footer-nav { 83 | justify-content: center; 84 | margin-bottom: 1rem; 85 | } 86 | .layout__copyright { 87 | margin-top: 1rem; 88 | font-size: 0.875rem; 89 | } 90 | .layout { 91 | display: flex; 92 | flex-direction: column; 93 | min-height: 100vh; 94 | } 95 | `] 96 | }) 97 | export class LayoutComponent { 98 | currentYear: number = new Date().getFullYear(); 99 | } 100 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/message.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { MessageService } from './message.service'; 4 | 5 | describe('MessageService', () => { 6 | let service: MessageService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(MessageService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/message.service.ts: -------------------------------------------------------------------------------- 1 | // src/app/services/message.service.ts 2 | import { Injectable } from '@angular/core'; 3 | import { Message } from './message'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class MessageService { 9 | private messages: Message[] = [ 10 | { id: 1, title: 'Welcome to the Home Page', content: 'This is the home page of our Angular application.' }, 11 | { id: 2, title: 'About Us', content: 'This is the about page of our Angular application.' } 12 | ]; 13 | 14 | getMessages(): Message[] { 15 | return this.messages; 16 | } 17 | 18 | getMessageById(id: number): Message | undefined { 19 | return this.messages.find(message => message.id === id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/app/message.ts: -------------------------------------------------------------------------------- 1 | export interface Message { 2 | id: number; 3 | title: string; 4 | content: string; 5 | } 6 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HelloAngular 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /data-files/hello-angular/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | html, body { 3 | margin: 0; 4 | padding: 0; 5 | height: 100%; 6 | } 7 | -------------------------------------------------------------------------------- /data-files/hello-angular/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/hello-angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /data-files/hello-angular/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/README.md: -------------------------------------------------------------------------------- 1 | # ImsClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ims-client": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/ims-client", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.development.ts" 58 | } 59 | ] 60 | } 61 | }, 62 | "defaultConfiguration": "production" 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "configurations": { 67 | "production": { 68 | "buildTarget": "ims-client:build:production" 69 | }, 70 | "development": { 71 | "buildTarget": "ims-client:build:development" 72 | } 73 | }, 74 | "defaultConfiguration": "development" 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n" 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "polyfills": [ 83 | "zone.js", 84 | "zone.js/testing" 85 | ], 86 | "tsConfig": "tsconfig.spec.json", 87 | "assets": [ 88 | { 89 | "glob": "**/*", 90 | "input": "public" 91 | } 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [], 97 | "karmaConfig": "karma.conf.js" 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/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-firefox-launcher'), 10 | require('karma-jasmine'), 11 | require('karma-chrome-launcher'), 12 | require('karma-jasmine-html-reporter'), 13 | require('karma-coverage'), 14 | require('@angular-devkit/build-angular/plugins/karma') 15 | ], 16 | client: { 17 | jasmine: { 18 | // you can add configuration options for Jasmine here 19 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 20 | // for example, you can disable the random execution with `random: false` 21 | // or set a specific seed with `seed: 4321` 22 | }, 23 | clearContext: false // leave Jasmine Spec Runner output visible in browser 24 | }, 25 | jasmineHtmlReporter: { 26 | suppressAll: true // removes the duplicated traces 27 | }, 28 | coverageReporter: { 29 | dir: require('path').join(__dirname, './coverage/ets-client'), 30 | subdir: '.', 31 | reporters: [ 32 | { type: 'html' }, 33 | { type: 'text-summary' } 34 | ] 35 | }, 36 | reporters: ['progress', 'kjhtml'], 37 | browsers: ['Firefox'], 38 | restartOnFileChange: true 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ims-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-firefox-launcher": "^2.1.3", 35 | "karma-jasmine": "~5.1.0", 36 | "karma-jasmine-html-reporter": "~2.1.0", 37 | "typescript": "~5.4.2" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/data-files/ims/ims-client/public/favicon.ico -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'ets-client' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('ets-client'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to the MEAN Stack Starter Project'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet], 8 | template: ` 9 |
10 |
11 |

Welcome to the MEAN Stack Starter Project

12 |
13 | 20 |
21 |
22 | 23 |
24 |
25 |
26 |

© 2024 MEAN Stack Project

27 |
28 |
29 | `, 30 | styles: ` 31 | .container { 32 | display: flex; 33 | flex-direction: column; 34 | min-height: 100vh; 35 | text-align: center; 36 | padding: 0; 37 | margin: 0 auto; 38 | } 39 | 40 | header, footer { 41 | background-color: #f8f9fa; 42 | padding: 10px 0; 43 | } 44 | 45 | nav ul { 46 | list-style-type: none; 47 | padding: 0; 48 | } 49 | 50 | nav ul li { 51 | display: inline; 52 | margin-right: 10px; 53 | } 54 | 55 | main { 56 | flex: 1; 57 | } 58 | ` 59 | }) 60 | export class AppComponent { 61 | title = 'ets-client'; 62 | } 63 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | import { provideHttpClient } from '@angular/common/http'; 6 | 7 | export const appConfig: ApplicationConfig = { 8 | providers: [ 9 | provideZoneChangeDetection({ eventCoalescing: true }), 10 | provideRouter(routes), 11 | provideHttpClient() 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | 4 | export const routes: Routes = [ 5 | { 6 | path: '', 7 | component: HomeComponent 8 | } 9 | ]; 10 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 3 | import { HomeComponent } from './home.component'; 4 | import { environment } from '../../environments/environment'; 5 | 6 | describe('HomeComponent', () => { 7 | let component: HomeComponent; 8 | let fixture: ComponentFixture; 9 | let httpTestingController: HttpTestingController; 10 | 11 | beforeEach(async () => { 12 | await TestBed.configureTestingModule({ 13 | imports: [HomeComponent, HttpClientTestingModule] 14 | }) 15 | .compileComponents(); 16 | 17 | httpTestingController = TestBed.inject(HttpTestingController); 18 | 19 | fixture = TestBed.createComponent(HomeComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { environment } from '../../environments/environment'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |

Main Content

11 |

This is a basic layout for your MEAN stack project.

12 |

Server message: {{ serverMessage }}

13 | `, 14 | styles: `` 15 | }) 16 | export class HomeComponent { 17 | serverMessage: string; 18 | 19 | constructor(private http: HttpClient) { 20 | this.serverMessage = ''; 21 | 22 | // Simulate a server request that takes 2 seconds to complete 23 | setTimeout(() => { 24 | this.http.get(`${environment.apiBaseUrl}/api`).subscribe({ 25 | next: (res: any) => { 26 | this.serverMessage = res['message']; 27 | }, 28 | error: (err) => { 29 | this.serverMessage = 'Error loading server message'; 30 | } 31 | }); 32 | }, 2000); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/environments/environment.development.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: false, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ImsClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | height: 100%; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /data-files/ims/ims-client/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/.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 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../src/app'); 8 | var debug = require('debug')('ets-server:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/jsconfig copy.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/ims/ims-server/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/ims/ims-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ims-server", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www", 7 | "dev": "nodemon ./bin/www", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "ajv": "^8.17.1", 12 | "cookie-parser": "~1.4.4", 13 | "debug": "~2.6.9", 14 | "express": "~4.16.1", 15 | "http-errors": "^2.0.0", 16 | "morgan": "~1.9.1" 17 | }, 18 | "devDependencies": { 19 | "@types/jest": "^29.5.12", 20 | "jest": "^29.7.0", 21 | "nodemon": "^3.1.4", 22 | "supertest": "^7.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/src/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.js 5 | * Description: Application setup. Autogenerated using Express generator. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const cookieParser = require('cookie-parser'); 11 | const logger = require('morgan'); 12 | const { notFoundHandler, errorHandler } = require('./error-handler'); 13 | 14 | // Importing the index router 15 | const indexRouter = require('./routes/index'); 16 | 17 | // Variable declaration for the express app 18 | let app = express(); 19 | 20 | // CORS configuration 21 | app.use((req, res, next) => { 22 | res.setHeader('Access-Control-Allow-Origin', '*'); // This allows all origins 23 | res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed request methods 24 | res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // Allowed headers 25 | next(); 26 | }); 27 | 28 | // Express app configuration 29 | app.use(logger('dev')); 30 | app.use(express.json()); 31 | app.use(express.urlencoded({ extended: false })); 32 | app.use(cookieParser()); 33 | 34 | // Routing configuration 35 | app.use('/api', indexRouter); 36 | 37 | // Use the error handling middleware 38 | app.use(notFoundHandler); 39 | app.use(errorHandler); 40 | 41 | // Export the app 42 | module.exports = app; 43 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/src/error-handler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: error-handler.js 5 | * Description: Error handling middleware functions. 6 | */ 7 | 8 | // Require statements 9 | const createError = require('http-errors'); 10 | 11 | /** 12 | * @description 13 | * Middleware function for handling 404 errors in an Express application. 14 | * 15 | * This middleware catches any requests that do not match any routes and creates 16 | * a 404 Not Found error. The error is then passed to the next middleware function 17 | * for further handling. 18 | * 19 | * Usage: 20 | * 21 | * app.use(notFoundHandler); 22 | * 23 | * Example: 24 | * 25 | * // Define routes 26 | * app.get('/example', (req, res) => { 27 | * res.send('Example route'); 28 | * }); 29 | * 30 | * // 404 error handling middleware 31 | * app.use(notFoundHandler); 32 | * 33 | * In this example, if a request is made to a route that does not exist, the 34 | * notFoundHandler middleware will create a 404 Not Found error and pass it to 35 | * the next middleware function. 36 | */ 37 | const notFoundHandler = (req, res, next) => { 38 | const error = createError(404, 'Not Found'); 39 | next(error); 40 | }; 41 | 42 | /** 43 | * @description 44 | * Middleware function for handling errors in an Express application. 45 | * 46 | * This middleware catches any errors that occur during the request-response cycle 47 | * and sends a JSON response with the error details. The response includes the error 48 | * type, status, message, and stack trace (if in development mode). 49 | * 50 | * Usage: 51 | * 52 | * app.use(errorHandler); 53 | * 54 | * Example: 55 | * 56 | * // Define routes 57 | * app.get('/example', (req, res) => { 58 | * throw new Error('Example error'); 59 | * }); 60 | * 61 | * // Error handling middleware 62 | * app.use(errorHandler); 63 | * 64 | * In this example, if an error occurs in the '/example' route, the error handling 65 | * middleware will catch it and send a JSON response with the error details. 66 | */ 67 | const errorHandler = (err, req, res, next) => { 68 | res.status(err.status || 500); 69 | res.json({ 70 | type: 'error', 71 | status: err.status, 72 | message: err.message, 73 | stack: req.app.get('env') === 'development' ? err.stack : undefined 74 | }); 75 | } 76 | 77 | // Export the middleware functions 78 | module.exports = { 79 | notFoundHandler, 80 | errorHandler 81 | }; -------------------------------------------------------------------------------- /data-files/ims/ims-server/src/routes/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: index.js 5 | * Description: Routing for the index page. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const router = express.Router(); 11 | 12 | /** 13 | * @description 14 | * Route handler for the root path ('/'). 15 | * 16 | * This route responds with a JSON message when accessed. 17 | * 18 | * Usage: 19 | * 20 | * router.get('/', function(req, res, next) { 21 | * res.send({ 22 | * message: 'Hello from the ETS server!' 23 | * }); 24 | * }); 25 | * 26 | * Example: 27 | * 28 | * // Accessing the root path 29 | * // GET http:/// 30 | * 31 | * // Response: 32 | * // { 33 | * // "message": "Hello from the ETS server!" 34 | * // } 35 | */ 36 | router.get('/', function(req, res, next) { 37 | const appName = 'Inventory Management System'; 38 | res.send({ 39 | message: `Hello from the ${appName} server!` 40 | }); 41 | }); 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /data-files/ims/ims-server/test/app.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.spec.js 5 | * Description: Test file for the Express application setup. 6 | */ 7 | 8 | // Require statements 9 | const request = require('supertest'); 10 | const express = require('express'); 11 | const app = require('../src/app'); 12 | const { errorHandler } = require('../src/error-handler'); 13 | 14 | // Test cases 15 | describe('app.js', () => { 16 | // Test the CORS configuration 17 | it('should set CORS headers', async () => { 18 | const response = await request(app).get('/api'); 19 | expect(response.headers['access-control-allow-origin']).toBe('*'); 20 | expect(response.headers['access-control-allow-methods']).toBe('GET, POST, PUT, DELETE, OPTIONS'); 21 | expect(response.headers['access-control-allow-headers']).toBe('Origin, X-Requested-With, Content-Type, Accept'); 22 | }); 23 | 24 | // Test the 500 error handler 25 | it('should handle 500 errors and return appropriate response', async () => { 26 | // Create a new instance of the app for testing 27 | const testApp = express(); 28 | 29 | // Define a route that throws an error 30 | testApp.get('/error', (req, res, next) => { 31 | const error = new Error('Test error'); 32 | error.status = 500; 33 | next(error); 34 | }); 35 | 36 | // Use the error handling middleware directly 37 | testApp.use(errorHandler); 38 | 39 | const response = await request(testApp).get('/error'); 40 | expect(response.status).toBe(500); 41 | expect(response.body).toEqual(expect.objectContaining({ 42 | type: 'error', 43 | status: 500, 44 | message: 'Test error' 45 | })); 46 | }); 47 | 48 | // Test the 404 error handler 49 | it('should return 404 for undefined routes', async () => { 50 | const response = await request(app).get('/undefined-route'); 51 | expect(response.status).toBe(404); 52 | expect(response.body).toEqual(expect.objectContaining({ 53 | type: 'error', 54 | status: 404, 55 | message: 'Not Found' 56 | })); 57 | }); 58 | }); -------------------------------------------------------------------------------- /data-files/tms/tms-client/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/README.md: -------------------------------------------------------------------------------- 1 | # TmsClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "tms-client": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/tms-client", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.development.ts" 58 | } 59 | ] 60 | } 61 | }, 62 | "defaultConfiguration": "production" 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "configurations": { 67 | "production": { 68 | "buildTarget": "tms-client:build:production" 69 | }, 70 | "development": { 71 | "buildTarget": "tms-client:build:development" 72 | } 73 | }, 74 | "defaultConfiguration": "development" 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n" 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "polyfills": [ 83 | "zone.js", 84 | "zone.js/testing" 85 | ], 86 | "tsConfig": "tsconfig.spec.json", 87 | "assets": [ 88 | { 89 | "glob": "**/*", 90 | "input": "public" 91 | } 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [], 97 | "karmaConfig": "karma.conf.js" 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/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-firefox-launcher'), 10 | require('karma-jasmine'), 11 | require('karma-chrome-launcher'), 12 | require('karma-jasmine-html-reporter'), 13 | require('karma-coverage'), 14 | require('@angular-devkit/build-angular/plugins/karma') 15 | ], 16 | client: { 17 | jasmine: { 18 | // you can add configuration options for Jasmine here 19 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 20 | // for example, you can disable the random execution with `random: false` 21 | // or set a specific seed with `seed: 4321` 22 | }, 23 | clearContext: false // leave Jasmine Spec Runner output visible in browser 24 | }, 25 | jasmineHtmlReporter: { 26 | suppressAll: true // removes the duplicated traces 27 | }, 28 | coverageReporter: { 29 | dir: require('path').join(__dirname, './coverage/ets-client'), 30 | subdir: '.', 31 | reporters: [ 32 | { type: 'html' }, 33 | { type: 'text-summary' } 34 | ] 35 | }, 36 | reporters: ['progress', 'kjhtml'], 37 | browsers: ['Firefox'], 38 | restartOnFileChange: true 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tms-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-firefox-launcher": "^2.1.3", 35 | "karma-jasmine": "~5.1.0", 36 | "karma-jasmine-html-reporter": "~2.1.0", 37 | "typescript": "~5.4.2" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/data-files/tms/tms-client/public/favicon.ico -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'ets-client' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('ets-client'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to the MEAN Stack Starter Project'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet], 8 | template: ` 9 |
10 |
11 |

Welcome to the MEAN Stack Starter Project

12 |
13 | 20 |
21 |
22 | 23 |
24 |
25 |
26 |

© 2024 MEAN Stack Project

27 |
28 |
29 | `, 30 | styles: ` 31 | .container { 32 | display: flex; 33 | flex-direction: column; 34 | min-height: 100vh; 35 | text-align: center; 36 | padding: 0; 37 | margin: 0 auto; 38 | } 39 | 40 | header, footer { 41 | background-color: #f8f9fa; 42 | padding: 10px 0; 43 | } 44 | 45 | nav ul { 46 | list-style-type: none; 47 | padding: 0; 48 | } 49 | 50 | nav ul li { 51 | display: inline; 52 | margin-right: 10px; 53 | } 54 | 55 | main { 56 | flex: 1; 57 | } 58 | ` 59 | }) 60 | export class AppComponent { 61 | title = 'ets-client'; 62 | } 63 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | import { provideHttpClient } from '@angular/common/http'; 6 | 7 | export const appConfig: ApplicationConfig = { 8 | providers: [ 9 | provideZoneChangeDetection({ eventCoalescing: true }), 10 | provideRouter(routes), 11 | provideHttpClient() 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | 4 | export const routes: Routes = [ 5 | { 6 | path: '', 7 | component: HomeComponent 8 | } 9 | ]; 10 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; 3 | import { HomeComponent } from './home.component'; 4 | import { environment } from '../../environments/environment'; 5 | 6 | describe('HomeComponent', () => { 7 | let component: HomeComponent; 8 | let fixture: ComponentFixture; 9 | let httpTestingController: HttpTestingController; 10 | 11 | beforeEach(async () => { 12 | await TestBed.configureTestingModule({ 13 | imports: [HomeComponent, HttpClientTestingModule] 14 | }) 15 | .compileComponents(); 16 | 17 | httpTestingController = TestBed.inject(HttpTestingController); 18 | 19 | fixture = TestBed.createComponent(HomeComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { environment } from '../../environments/environment'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | standalone: true, 8 | imports: [], 9 | template: ` 10 |

Main Content

11 |

This is a basic layout for your MEAN stack project.

12 |

Server message: {{ serverMessage }}

13 | `, 14 | styles: `` 15 | }) 16 | export class HomeComponent { 17 | serverMessage: string; 18 | 19 | constructor(private http: HttpClient) { 20 | this.serverMessage = ''; 21 | 22 | // Simulate a server request that takes 2 seconds to complete 23 | setTimeout(() => { 24 | this.http.get(`${environment.apiBaseUrl}/api`).subscribe({ 25 | next: (res: any) => { 26 | this.serverMessage = res['message']; 27 | }, 28 | error: (err) => { 29 | this.serverMessage = 'Error loading server message'; 30 | } 31 | }); 32 | }, 2000); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/environments/environment.development.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: false, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiBaseUrl: 'http://localhost:3000' 4 | }; 5 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TmsClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | height: 100%; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /data-files/tms/tms-client/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/.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 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../src/app'); 8 | var debug = require('debug')('ets-server:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/jsconfig copy.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/tms/tms-server/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["jest"] 4 | } 5 | } -------------------------------------------------------------------------------- /data-files/tms/tms-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tms-server", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www", 7 | "dev": "nodemon ./bin/www", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "ajv": "^8.17.1", 12 | "cookie-parser": "~1.4.4", 13 | "debug": "~2.6.9", 14 | "express": "~4.16.1", 15 | "http-errors": "^2.0.0", 16 | "morgan": "~1.9.1" 17 | }, 18 | "devDependencies": { 19 | "@types/jest": "^29.5.12", 20 | "jest": "^29.7.0", 21 | "nodemon": "^3.1.4", 22 | "supertest": "^7.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/src/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.js 5 | * Description: Application setup. Autogenerated using Express generator. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const createError = require('http-errors'); 11 | const cookieParser = require('cookie-parser'); 12 | const logger = require('morgan'); 13 | const { notFoundHandler, errorHandler } = require('./error-handler'); 14 | 15 | // Importing the index router 16 | const indexRouter = require('./routes/index'); 17 | 18 | // Variable declaration for the express app 19 | let app = express(); 20 | 21 | // CORS configuration 22 | app.use((req, res, next) => { 23 | res.setHeader('Access-Control-Allow-Origin', '*'); // This allows all origins 24 | res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed request methods 25 | res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // Allowed headers 26 | next(); 27 | }); 28 | 29 | // Express app configuration 30 | app.use(logger('dev')); 31 | app.use(express.json()); 32 | app.use(express.urlencoded({ extended: false })); 33 | app.use(cookieParser()); 34 | 35 | // Routing configuration 36 | app.use('/api', indexRouter); 37 | 38 | // Use the error handling middleware 39 | app.use(notFoundHandler); 40 | app.use(errorHandler); 41 | 42 | // Export the app 43 | module.exports = app; 44 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/src/error-handler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: error-handler.js 5 | * Description: Error handling middleware functions. 6 | */ 7 | 8 | // Require statements 9 | const createError = require('http-errors'); 10 | 11 | /** 12 | * @description 13 | * Middleware function for handling 404 errors in an Express application. 14 | * 15 | * This middleware catches any requests that do not match any routes and creates 16 | * a 404 Not Found error. The error is then passed to the next middleware function 17 | * for further handling. 18 | * 19 | * Usage: 20 | * 21 | * app.use(notFoundHandler); 22 | * 23 | * Example: 24 | * 25 | * // Define routes 26 | * app.get('/example', (req, res) => { 27 | * res.send('Example route'); 28 | * }); 29 | * 30 | * // 404 error handling middleware 31 | * app.use(notFoundHandler); 32 | * 33 | * In this example, if a request is made to a route that does not exist, the 34 | * notFoundHandler middleware will create a 404 Not Found error and pass it to 35 | * the next middleware function. 36 | */ 37 | const notFoundHandler = (req, res, next) => { 38 | const error = createError(404, 'Not Found'); 39 | next(error); 40 | }; 41 | 42 | /** 43 | * @description 44 | * Middleware function for handling errors in an Express application. 45 | * 46 | * This middleware catches any errors that occur during the request-response cycle 47 | * and sends a JSON response with the error details. The response includes the error 48 | * type, status, message, and stack trace (if in development mode). 49 | * 50 | * Usage: 51 | * 52 | * app.use(errorHandler); 53 | * 54 | * Example: 55 | * 56 | * // Define routes 57 | * app.get('/example', (req, res) => { 58 | * throw new Error('Example error'); 59 | * }); 60 | * 61 | * // Error handling middleware 62 | * app.use(errorHandler); 63 | * 64 | * In this example, if an error occurs in the '/example' route, the error handling 65 | * middleware will catch it and send a JSON response with the error details. 66 | */ 67 | const errorHandler = (err, req, res, next) => { 68 | res.status(err.status || 500); 69 | res.json({ 70 | type: 'error', 71 | status: err.status, 72 | message: err.message, 73 | stack: req.app.get('env') === 'development' ? err.stack : undefined 74 | }); 75 | } 76 | 77 | // Export the middleware functions 78 | module.exports = { 79 | notFoundHandler, 80 | errorHandler 81 | }; -------------------------------------------------------------------------------- /data-files/tms/tms-server/src/routes/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: index.js 5 | * Description: Routing for the index page. 6 | */ 7 | 8 | // require statements 9 | const express = require('express'); 10 | const router = express.Router(); 11 | 12 | /** 13 | * @description 14 | * Route handler for the root path ('/'). 15 | * 16 | * This route responds with a JSON message when accessed. 17 | * 18 | * Usage: 19 | * 20 | * router.get('/', function(req, res, next) { 21 | * res.send({ 22 | * message: 'Hello from the ETS server!' 23 | * }); 24 | * }); 25 | * 26 | * Example: 27 | * 28 | * // Accessing the root path 29 | * // GET http:/// 30 | * 31 | * // Response: 32 | * // { 33 | * // "message": "Hello from the ETS server!" 34 | * // } 35 | */ 36 | router.get('/', function(req, res, next) { 37 | const appName = 'Task Management System'; 38 | res.send({ 39 | message: `Hello from the ${appName} server!` 40 | }); 41 | }); 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /data-files/tms/tms-server/test/app.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Author: Professor Krasso 3 | * Date: 7 August 2024 4 | * File: app.spec.js 5 | * Description: Test file for the Express application setup. 6 | */ 7 | 8 | // Require statements 9 | const request = require('supertest'); 10 | const express = require('express'); 11 | const app = require('../src/app'); 12 | const { errorHandler } = require('../src/error-handler'); 13 | 14 | // Test cases 15 | describe('app.js', () => { 16 | // Test the CORS configuration 17 | it('should set CORS headers', async () => { 18 | const response = await request(app).get('/api'); 19 | expect(response.headers['access-control-allow-origin']).toBe('*'); 20 | expect(response.headers['access-control-allow-methods']).toBe('GET, POST, PUT, DELETE, OPTIONS'); 21 | expect(response.headers['access-control-allow-headers']).toBe('Origin, X-Requested-With, Content-Type, Accept'); 22 | }); 23 | 24 | // Test the 500 error handler 25 | it('should handle 500 errors and return appropriate response', async () => { 26 | // Create a new instance of the app for testing 27 | const testApp = express(); 28 | 29 | // Define a route that throws an error 30 | testApp.get('/error', (req, res, next) => { 31 | const error = new Error('Test error'); 32 | error.status = 500; 33 | next(error); 34 | }); 35 | 36 | // Use the error handling middleware directly 37 | testApp.use(errorHandler); 38 | 39 | const response = await request(testApp).get('/error'); 40 | expect(response.status).toBe(500); 41 | expect(response.body).toEqual(expect.objectContaining({ 42 | type: 'error', 43 | status: 500, 44 | message: 'Test error' 45 | })); 46 | }); 47 | 48 | // Test the 404 error handler 49 | it('should return 404 for undefined routes', async () => { 50 | const response = await request(app).get('/undefined-route'); 51 | expect(response.status).toBe(404); 52 | expect(response.body).toEqual(expect.objectContaining({ 53 | type: 'error', 54 | status: 404, 55 | message: 'Not Found' 56 | })); 57 | }); 58 | }); -------------------------------------------------------------------------------- /examples/data-samples/ets/categories.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "userId": 1000, 5 | "categoryId": 1, 6 | "name": "Food", 7 | "description": "Food and beverages", 8 | "dateCreated": "2021-01-01T00:00:00.000Z", 9 | "dateModified": "2021-01-01T00:00:00.000Z" 10 | } 11 | ] -------------------------------------------------------------------------------- /examples/data-samples/ets/expenses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "userId": 1000, 5 | "categoryId": 1, 6 | "amount": 100.00, 7 | "description": "Lunch", 8 | "date": "2021-01-01T00:00:00.000Z", 9 | "dateCreated": "2021-01-01T00:00:00.000Z", 10 | "dateModified": "2021-01-01T00:00:00.000Z" 11 | } 12 | ] -------------------------------------------------------------------------------- /examples/data-samples/ets/users.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "userId": 1000, 5 | "username": "testuser01", 6 | "password": "hashedpassword", 7 | "email": "testuser01@ets.com", 8 | "dateCreated": "2021-01-01T00:00:00.000Z", 9 | "dateModified": "2021-01-01T00:00:00.000Z" 10 | } 11 | ] -------------------------------------------------------------------------------- /examples/data-samples/gms/gardens.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "gardenId": 1000, 5 | "name": "Backyard Garden", 6 | "location": "123 Garden Lane", 7 | "description": "A beautiful backyard garden with a variety of plants.", 8 | "dateCreated": "2021-01-01T00:00:00.000Z", 9 | "dateModified": "2021-01-05T00:00:00.000Z" 10 | } 11 | ] -------------------------------------------------------------------------------- /examples/data-samples/gms/plants.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "name": "Rose", 5 | "type": "Flower", 6 | "status": "Growing", 7 | "datePlanted": "2021-01-01T00:00:00.000Z", 8 | "dateHarvested": null, 9 | "dateCreated": "2021-01-01T00:00:00.000Z", 10 | "dateModified": "2021-01-05T00:00:00.000Z", 11 | "gardenId": 1000 12 | } 13 | ] -------------------------------------------------------------------------------- /examples/data-samples/ims/categories.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "categoryId": 1000, 5 | "categoryName": "Electronics", 6 | "description": "Electronic devices and gadgets", 7 | "dateCreated": "2021-01-01T00:00:00.000Z", 8 | "dateModified": "2021-01-01T00:00:00.000Z" 9 | } 10 | ] -------------------------------------------------------------------------------- /examples/data-samples/ims/inventory-items.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "categoryId": 1000, 5 | "supplierId": 1, 6 | "name": "Laptop", 7 | "description": "High-end gaming laptop", 8 | "quantity": 10, 9 | "price": 1500.00, 10 | "dateCreated": "2021-01-01T00:00:00.000Z", 11 | "dateModified": "2021-01-01T00:00:00.000Z" 12 | } 13 | ] -------------------------------------------------------------------------------- /examples/data-samples/ims/suppliers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "supplierId": 1, 5 | "supplierName": "TechSupplier", 6 | "contactInformation": "123-456-7890", 7 | "address": "123 Tech Street", 8 | "dateCreated": "2021-01-01T00:00:00.000Z", 9 | "dateModified": "2021-01-01T00:00:00.000Z" 10 | } 11 | ] -------------------------------------------------------------------------------- /examples/data-samples/tms/projects.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "projectId": 1000, 5 | "name": "Project Alpha", 6 | "description": "Initial phase of the project", 7 | "startDate": "2021-01-01T00:00:00.000Z", 8 | "endDate": "2021-06-01T00:00:00.000Z", 9 | "dateCreated": "2021-01-01T00:00:00.000Z", 10 | "dateModified": "2021-01-05T00:00:00.000Z" 11 | } 12 | ] -------------------------------------------------------------------------------- /examples/data-samples/tms/tasks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "650c1f1e1c9d440000a1b1c1", 4 | "title": "Complete project documentation", 5 | "description": "Write the documentation for the project", 6 | "status": "In Progress", 7 | "priority": "High", 8 | "dueDate": "2021-01-10T00:00:00.000Z", 9 | "dateCreated": "2021-01-01T00:00:00.000Z", 10 | "dateModified": "2021-01-05T00:00:00.000Z", 11 | "projectId": 1000 12 | } 13 | ] -------------------------------------------------------------------------------- /examples/mean-dist/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/README.md: -------------------------------------------------------------------------------- 1 | # MeanClient 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "mean-client": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/mean-client", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true 54 | } 55 | }, 56 | "defaultConfiguration": "production" 57 | }, 58 | "serve": { 59 | "builder": "@angular-devkit/build-angular:dev-server", 60 | "configurations": { 61 | "production": { 62 | "buildTarget": "mean-client:build:production" 63 | }, 64 | "development": { 65 | "buildTarget": "mean-client:build:development" 66 | } 67 | }, 68 | "defaultConfiguration": "development" 69 | }, 70 | "extract-i18n": { 71 | "builder": "@angular-devkit/build-angular:extract-i18n" 72 | }, 73 | "test": { 74 | "builder": "@angular-devkit/build-angular:karma", 75 | "options": { 76 | "polyfills": [ 77 | "zone.js", 78 | "zone.js/testing" 79 | ], 80 | "tsConfig": "tsconfig.spec.json", 81 | "assets": [ 82 | { 83 | "glob": "**/*", 84 | "input": "public" 85 | } 86 | ], 87 | "styles": [ 88 | "src/styles.css" 89 | ], 90 | "scripts": [] 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mean-client", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^18.0.0", 14 | "@angular/common": "^18.0.0", 15 | "@angular/compiler": "^18.0.0", 16 | "@angular/core": "^18.0.0", 17 | "@angular/forms": "^18.0.0", 18 | "@angular/platform-browser": "^18.0.0", 19 | "@angular/platform-browser-dynamic": "^18.0.0", 20 | "@angular/router": "^18.0.0", 21 | "rxjs": "~7.8.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.14.3" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "^18.0.3", 27 | "@angular/cli": "^18.0.3", 28 | "@angular/compiler-cli": "^18.0.0", 29 | "@types/jasmine": "~5.1.0", 30 | "jasmine-core": "~5.1.0", 31 | "karma": "~6.4.0", 32 | "karma-chrome-launcher": "~3.2.0", 33 | "karma-coverage": "~2.2.0", 34 | "karma-jasmine": "~5.1.0", 35 | "karma-jasmine-html-reporter": "~2.1.0", 36 | "typescript": "~5.4.2" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/examples/mean-dist/mean-client/public/favicon.ico -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/about/about.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AboutComponent } from './about.component'; 4 | 5 | describe('AboutComponent', () => { 6 | let component: AboutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [AboutComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(AboutComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-about', 5 | standalone: true, 6 | imports: [], 7 | template: ` 8 |

9 | Welcome to the About Page! Here you will find all the information about our company. 10 |

11 | `, 12 | styles: `` 13 | }) 14 | export class AboutComponent { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'mean-client' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('mean-client'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Hello, mean-client'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterLink, RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet, RouterLink], 8 | template: ` 9 |
10 | 16 | 17 |
18 |
19 | {{ title }} 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 | © 2024 Professor Krasso 28 |
29 |
30 | `, 31 | styles: ` 32 | .container { 33 | display: flex; 34 | flex-direction: column; 35 | min-height: 100vh; 36 | } 37 | 38 | .side-menu { 39 | width: 250px; /* Increased width for the navigation menu */ 40 | background-color: #343a40; /* Bootstrap dark background color */ 41 | color: white; 42 | padding: 20px 10px; /* Added padding at the top */ 43 | height: 100vh; /* Full height of the viewport */ 44 | position: fixed; /* Fix the position to the left */ 45 | } 46 | 47 | .side-menu h2 { 48 | margin-top: 0; 49 | border-bottom: 1px solid white; /* Add a line below the title */ 50 | padding-bottom: 5px; 51 | } 52 | 53 | .side-menu a { 54 | display: block; 55 | margin-bottom: 10px; 56 | color: white; 57 | text-decoration: none; 58 | } 59 | 60 | .side-menu a:hover { 61 | text-decoration: underline; 62 | } 63 | 64 | .main-content { 65 | margin-left: 270px; /* Adjusted space to the left for the wider side menu */ 66 | flex: 1; 67 | display: flex; 68 | flex-direction: column; 69 | } 70 | 71 | header { 72 | text-align: center; 73 | font-size: 1.5em; 74 | margin-bottom: 20px; /* Add gap below the header */ 75 | padding: 20px; 76 | } 77 | 78 | main { 79 | flex: 1; 80 | padding: 10px; 81 | } 82 | 83 | footer { 84 | text-align: center; 85 | background-color: #f8f9fa; /* Bootstrap light background color */ 86 | color: black; 87 | padding: 10px; 88 | margin-top: auto; /* Push footer to the bottom */ 89 | } 90 | ` 91 | }) 92 | export class AppComponent { 93 | title = 'Welcome to the MEAN Stack!'; 94 | } 95 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | import { provideHttpClient } from '@angular/common/http'; 6 | 7 | export const appConfig: ApplicationConfig = { 8 | providers: [ 9 | provideZoneChangeDetection({ eventCoalescing: true }), 10 | provideRouter(routes), 11 | provideHttpClient() 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | import { ContactComponent } from './contact/contact.component'; 4 | import { AboutComponent } from './about/about.component'; 5 | 6 | export const routes: Routes = [ 7 | { 8 | path: '', 9 | component: HomeComponent 10 | }, 11 | { 12 | path: 'about', 13 | component: AboutComponent 14 | }, 15 | { 16 | path: 'contact', 17 | component: ContactComponent 18 | } 19 | ]; 20 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/contact/contact.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ContactComponent } from './contact.component'; 4 | 5 | describe('ContactComponent', () => { 6 | let component: ContactComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [ContactComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(ContactComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/contact/contact.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-contact', 5 | standalone: true, 6 | imports: [], 7 | template: ` 8 |

9 | Welcome to the Contact Page! Here you will find all the information you need to get in touch with us. 10 |

11 | `, 12 | styles: `` 13 | }) 14 | export class ContactComponent { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [HomeComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(HomeComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | @Component({ 5 | selector: 'app-home', 6 | standalone: true, 7 | imports: [], 8 | template: ` 9 |

10 | Welcome to the Homepage! Here you will find all the information you need to get started with the MEAN stack. 11 |

12 |

Message from the server: {{ serverMessage }}

13 | `, 14 | styles: `` 15 | }) 16 | export class HomeComponent { 17 | serverMessage: string; 18 | 19 | constructor(private http: HttpClient) { 20 | this.serverMessage = 'Loading...'; 21 | 22 | this.http.get('http://localhost:3000/api/hello').subscribe((data: any) => { 23 | setTimeout(() => { 24 | this.serverMessage = data.message; 25 | console.log(data); 26 | }, 2000); // Simulate a slow connection 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MeanClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | } 7 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-client/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/.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 = false 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/app.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const createError = require('http-errors'); 3 | const url = require('url'); 4 | 5 | const helloRouter = require('./routes/hello/index') 6 | 7 | const app = express(); 8 | 9 | app.use((req, res, next) => { 10 | res.setHeader('Access-Control-Allow-Origin', '*'); // This allows all origins 11 | res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'); // Allowed request methods 12 | res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // Allowed headers 13 | next(); 14 | }); 15 | 16 | app.use(express.json()); 17 | app.use(express.urlencoded({ extended: true })) 18 | 19 | app.use('/api/hello', helloRouter); 20 | 21 | app.use((req, res, next) => { 22 | next(createError(404)); 23 | }); 24 | 25 | // error handler for all other errors 26 | app.use(function(err, req, res, next) { 27 | res.status(err.status || 500) 28 | 29 | res.json({ 30 | type: 'error', 31 | status: err.status, 32 | message: err.message, 33 | stack: req.app.get('env') === 'development' ? err.stack : undefined 34 | }) 35 | }) 36 | 37 | module.exports = app 38 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | const app = require('../app'); 8 | const http = require('http'); 9 | 10 | /** 11 | * Get port from environment and store in Express. 12 | */ 13 | 14 | const port = normalizePort(process.env.PORT || '3000'); 15 | app.set('port', port); 16 | 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | const server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | const port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | function onError(error) { 56 | if (error.syscall !== 'listen') { 57 | throw error; 58 | } 59 | 60 | const bind = typeof port === 'string' 61 | ? 'Pipe ' + port 62 | : 'Port ' + port; 63 | 64 | // handle specific listen errors with friendly messages 65 | switch (error.code) { 66 | case 'EACCES': 67 | console.error(bind + ' requires elevated privileges'); 68 | process.exit(1); 69 | break; 70 | case 'EADDRINUSE': 71 | console.error(bind + ' is already in use'); 72 | process.exit(1); 73 | break; 74 | default: 75 | throw error; 76 | } 77 | } 78 | 79 | /** 80 | * Event listener for HTTP server "listening" event. 81 | */ 82 | function onListening() { 83 | const addr = server.address(); 84 | const bind = typeof addr === 'string' 85 | ? 'pipe ' + addr 86 | : 'port ' + addr.port; 87 | 88 | console.log('Application started and listing on ' + bind) 89 | } 90 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mean-server", 3 | "version": "1.0.0", 4 | "main": "app.js", 5 | "scripts": { 6 | "start": "node ./bin/www", 7 | "server:dev": "nodemon ./bin/www", 8 | "test": "jest" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "description": "", 14 | "dependencies": { 15 | "express": "^4.19.2", 16 | "http-errors": "^2.0.0", 17 | "mongodb": "^6.8.0" 18 | }, 19 | "devDependencies": { 20 | "jest": "^29.7.0", 21 | "nodemon": "^3.1.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/routes/hello/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | router.get('/', (req, res, next) => { 5 | try { 6 | res.send({ 7 | message: 'Welcome to the MEAN Stack API' 8 | }) 9 | } catch (err) { 10 | console.error('Error occurred while retrieving data from the database', err); 11 | next(err); 12 | } 13 | }); 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /examples/mean-dist/mean-server/utils/mongo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Title: mongo.js 3 | * Author: Professor Krasso 4 | * Date: 8/4/23 5 | */ 6 | 'use strict' 7 | 8 | // Require statements 9 | const { MongoClient } = require('mongodb') 10 | 11 | // Connection string for MongoDB Atlas 12 | // TODO: Update this connection string with your own credentials 13 | const MONGO_URL = 'mongodb+srv://nodebucket_user:s3cret@cluster0.lujih.mongodb.net/nodebucketDB?retryWrites=true&w=majority' 14 | 15 | const mongo = async(operations, next) => { 16 | try { 17 | console.log('Connecting to MongoDB Atlas...') 18 | 19 | // Connect to the MongoDB cluster 20 | const client = await MongoClient.connect(MONGO_URL, { 21 | useNewUrlParser: true, 22 | useUnifiedTopology: true 23 | }) 24 | 25 | // Select the database 26 | const db = client.db('nodebucketDB') 27 | console.log('Connected to MongoDB Atlas') 28 | 29 | // Execute the passed in operation 30 | await operations(db) 31 | console.log('Operation was successful') 32 | 33 | // Close the connection 34 | client.close() 35 | console.log('Closing connection to MongoDB Atlas...') 36 | } catch (err) { 37 | // Catch any errors and throw an error 500 status 38 | const error = new Error('Error connecting to db', err) 39 | error.status = 500 40 | 41 | // Log out the error 42 | console.log('Error connecting to db', err) 43 | 44 | next(error) 45 | } 46 | } 47 | 48 | module.exports = { mongo } 49 | -------------------------------------------------------------------------------- /examples/mean/.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 = false 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /examples/mean/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | **/.vscode/ 25 | .vscode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # Miscellaneous 34 | /.angular/cache 35 | .sass-cache/ 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | testem.log 40 | /typings 41 | 42 | # System files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /examples/mean/README.md: -------------------------------------------------------------------------------- 1 | # Mean 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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. 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 28 | -------------------------------------------------------------------------------- /examples/mean/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "mean": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/mean", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | { 25 | "glob": "**/*", 26 | "input": "public" 27 | } 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kB", 40 | "maximumError": "1MB" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kB", 45 | "maximumError": "4kB" 46 | } 47 | ], 48 | "outputHashing": "all" 49 | }, 50 | "development": { 51 | "optimization": false, 52 | "extractLicenses": false, 53 | "sourceMap": true 54 | } 55 | }, 56 | "defaultConfiguration": "production" 57 | }, 58 | "serve": { 59 | "builder": "@angular-devkit/build-angular:dev-server", 60 | "options": { 61 | "proxyConfig": "src/proxy.conf.json" 62 | }, 63 | "configurations": { 64 | "production": { 65 | "buildTarget": "mean:build:production" 66 | }, 67 | "development": { 68 | "buildTarget": "mean:build:development" 69 | } 70 | }, 71 | "defaultConfiguration": "development" 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n" 75 | }, 76 | "test": { 77 | "builder": "@angular-devkit/build-angular:karma", 78 | "options": { 79 | "polyfills": [ 80 | "zone.js", 81 | "zone.js/testing" 82 | ], 83 | "tsConfig": "tsconfig.spec.json", 84 | "assets": [ 85 | { 86 | "glob": "**/*", 87 | "input": "public" 88 | } 89 | ], 90 | "styles": [ 91 | "src/styles.css" 92 | ], 93 | "scripts": [] 94 | } 95 | } 96 | } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /examples/mean/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | const app = require('../server/app'); 8 | const http = require('http'); 9 | 10 | /** 11 | * Get port from environment and store in Express. 12 | */ 13 | 14 | const port = normalizePort(process.env.PORT || '3000'); 15 | app.set('port', port); 16 | 17 | /** 18 | * Create HTTP server. 19 | */ 20 | 21 | const server = http.createServer(app); 22 | 23 | /** 24 | * Listen on provided port, on all network interfaces. 25 | */ 26 | 27 | server.listen(port); 28 | server.on('error', onError); 29 | server.on('listening', onListening); 30 | 31 | /** 32 | * Normalize a port into a number, string, or false. 33 | */ 34 | 35 | function normalizePort(val) { 36 | const port = parseInt(val, 10); 37 | 38 | if (isNaN(port)) { 39 | // named pipe 40 | return val; 41 | } 42 | 43 | if (port >= 0) { 44 | // port number 45 | return port; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | /** 52 | * Event listener for HTTP server "error" event. 53 | */ 54 | function onError(error) { 55 | if (error.syscall !== 'listen') { 56 | throw error; 57 | } 58 | 59 | const bind = typeof port === 'string' 60 | ? 'Pipe ' + port 61 | : 'Port ' + port; 62 | 63 | // handle specific listen errors with friendly messages 64 | switch (error.code) { 65 | case 'EACCES': 66 | console.error(bind + ' requires elevated privileges'); 67 | process.exit(1); 68 | break; 69 | case 'EADDRINUSE': 70 | console.error(bind + ' is already in use'); 71 | process.exit(1); 72 | break; 73 | default: 74 | throw error; 75 | } 76 | } 77 | 78 | /** 79 | * Event listener for HTTP server "listening" event. 80 | */ 81 | function onListening() { 82 | const addr = server.address(); 83 | const bind = typeof addr === 'string' 84 | ? 'pipe ' + addr 85 | : 'port ' + addr.port; 86 | 87 | console.log('Application started and listing on ' + bind) 88 | } 89 | -------------------------------------------------------------------------------- /examples/mean/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mean", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng build && node ./bin/www", 7 | "server": "nodemon ./bin/www", 8 | "build": "ng build", 9 | "watch": "ng build --watch --configuration development", 10 | "test": "ng test" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^18.0.0", 15 | "@angular/common": "^18.0.0", 16 | "@angular/compiler": "^18.0.0", 17 | "@angular/core": "^18.0.0", 18 | "@angular/forms": "^18.0.0", 19 | "@angular/platform-browser": "^18.0.0", 20 | "@angular/platform-browser-dynamic": "^18.0.0", 21 | "@angular/router": "^18.0.0", 22 | "express": "^4.19.2", 23 | "http-errors": "^2.0.0", 24 | "mongodb": "^6.8.0", 25 | "rxjs": "~7.8.0", 26 | "tslib": "^2.3.0", 27 | "zone.js": "~0.14.3" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "^18.0.3", 31 | "@angular/cli": "^18.0.3", 32 | "@angular/compiler-cli": "^18.0.0", 33 | "@types/jasmine": "~5.1.0", 34 | "jasmine-core": "~5.1.0", 35 | "karma": "~6.4.0", 36 | "karma-chrome-launcher": "~3.2.0", 37 | "karma-coverage": "~2.2.0", 38 | "karma-jasmine": "~5.1.0", 39 | "karma-jasmine-html-reporter": "~2.1.0", 40 | "nodemon": "^3.1.4", 41 | "typescript": "~5.4.2" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/mean/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buwebdev/web-450/b1ad7fe8286a82a0cf2a363b9ccad9b65d22e124/examples/mean/public/favicon.ico -------------------------------------------------------------------------------- /examples/mean/server/app.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const createError = require('http-errors'); 3 | const path = require('path'); 4 | 5 | const helloRouter = require('./routes/hello/index') 6 | 7 | const app = express(); 8 | 9 | app.use(express.json()); 10 | app.use(express.urlencoded({ extended: true })) 11 | app.use(express.static(path.join(__dirname, '../dist/mean/browser'))) 12 | app.use('/', express.static(path.join(__dirname, '../dist/mean/browser'))) 13 | 14 | app.use('/api/hello', helloRouter); 15 | 16 | app.use((req, res, next) => { 17 | next(createError(404)); 18 | }); 19 | 20 | // error handler for all other errors 21 | app.use(function(err, req, res, next) { 22 | res.status(err.status || 500) 23 | 24 | res.json({ 25 | type: 'error', 26 | status: err.status, 27 | message: err.message, 28 | stack: req.app.get('env') === 'development' ? err.stack : undefined 29 | }) 30 | }) 31 | 32 | module.exports = app 33 | -------------------------------------------------------------------------------- /examples/mean/server/routes/hello/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | router.get('/', (req, res, next) => { 5 | try { 6 | res.send({ 7 | message: 'Welcome to the MEAN Stack API' 8 | }) 9 | } catch (err) { 10 | console.error('Error occurred while retrieving data from the database', err); 11 | next(err); 12 | } 13 | }); 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /examples/mean/server/utils/mongo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Title: mongo.js 3 | * Author: Professor Krasso 4 | * Date: 8/4/23 5 | */ 6 | 'use strict' 7 | 8 | // Require statements 9 | const { MongoClient } = require('mongodb') 10 | 11 | // Connection string for MongoDB Atlas 12 | // TODO: Update this connection string with your own credentials 13 | const MONGO_URL = 'mongodb+srv://nodebucket_user:s3cret@cluster0.lujih.mongodb.net/nodebucketDB?retryWrites=true&w=majority' 14 | 15 | const mongo = async(operations, next) => { 16 | try { 17 | console.log('Connecting to MongoDB Atlas...') 18 | 19 | // Connect to the MongoDB cluster 20 | const client = await MongoClient.connect(MONGO_URL, { 21 | useNewUrlParser: true, 22 | useUnifiedTopology: true 23 | }) 24 | 25 | // Select the database 26 | const db = client.db('nodebucketDB') 27 | console.log('Connected to MongoDB Atlas') 28 | 29 | // Execute the passed in operation 30 | await operations(db) 31 | console.log('Operation was successful') 32 | 33 | // Close the connection 34 | client.close() 35 | console.log('Closing connection to MongoDB Atlas...') 36 | } catch (err) { 37 | // Catch any errors and throw an error 500 status 38 | const error = new Error('Error connecting to db', err) 39 | error.status = 500 40 | 41 | // Log out the error 42 | console.log('Error connecting to db', err) 43 | 44 | next(error) 45 | } 46 | } 47 | 48 | module.exports = { mongo } 49 | -------------------------------------------------------------------------------- /examples/mean/src/app/about/about.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AboutComponent } from './about.component'; 4 | 5 | describe('AboutComponent', () => { 6 | let component: AboutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [AboutComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(AboutComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-about', 5 | standalone: true, 6 | imports: [], 7 | template: ` 8 |

9 | Welcome to the About Page! Here you will find all the information about our company. 10 |

11 | `, 12 | styles: `` 13 | }) 14 | export class AboutComponent { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/mean/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | imports: [AppComponent], 8 | }).compileComponents(); 9 | }); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have the 'mean' title`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('mean'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('h1')?.textContent).toContain('Hello, mean'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /examples/mean/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterLink, RouterOutlet } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | standalone: true, 7 | imports: [RouterOutlet, RouterLink], 8 | template: ` 9 |
10 | 16 | 17 |
18 |
19 | {{ title }} 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 | © 2024 Professor Krasso 28 |
29 |
30 | `, 31 | styles: ` 32 | .container { 33 | display: flex; 34 | flex-direction: column; 35 | min-height: 100vh; 36 | } 37 | 38 | .side-menu { 39 | width: 250px; /* Increased width for the navigation menu */ 40 | background-color: #343a40; /* Bootstrap dark background color */ 41 | color: white; 42 | padding: 20px 10px; /* Added padding at the top */ 43 | height: 100vh; /* Full height of the viewport */ 44 | position: fixed; /* Fix the position to the left */ 45 | } 46 | 47 | .side-menu h2 { 48 | margin-top: 0; 49 | border-bottom: 1px solid white; /* Add a line below the title */ 50 | padding-bottom: 5px; 51 | } 52 | 53 | .side-menu a { 54 | display: block; 55 | margin-bottom: 10px; 56 | color: white; 57 | text-decoration: none; 58 | } 59 | 60 | .side-menu a:hover { 61 | text-decoration: underline; 62 | } 63 | 64 | .main-content { 65 | margin-left: 270px; /* Adjusted space to the left for the wider side menu */ 66 | flex: 1; 67 | display: flex; 68 | flex-direction: column; 69 | } 70 | 71 | header { 72 | text-align: center; 73 | font-size: 1.5em; 74 | margin-bottom: 20px; /* Add gap below the header */ 75 | padding: 20px; 76 | } 77 | 78 | main { 79 | flex: 1; 80 | padding: 10px; 81 | } 82 | 83 | footer { 84 | text-align: center; 85 | background-color: #f8f9fa; /* Bootstrap light background color */ 86 | color: black; 87 | padding: 10px; 88 | margin-top: auto; /* Push footer to the bottom */ 89 | } 90 | ` 91 | }) 92 | export class AppComponent { 93 | title = 'Welcome to the MEAN Stack!'; 94 | } 95 | -------------------------------------------------------------------------------- /examples/mean/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; 2 | import { provideRouter } from '@angular/router'; 3 | 4 | import { routes } from './app.routes'; 5 | 6 | export const appConfig: ApplicationConfig = { 7 | providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)] 8 | }; 9 | -------------------------------------------------------------------------------- /examples/mean/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { HomeComponent } from './home/home.component'; 3 | import { ContactComponent } from './contact/contact.component'; 4 | import { AboutComponent } from './about/about.component'; 5 | 6 | export const routes: Routes = [ 7 | { 8 | path: '', 9 | component: HomeComponent 10 | }, 11 | { 12 | path: 'about', 13 | component: AboutComponent 14 | }, 15 | { 16 | path: 'contact', 17 | component: ContactComponent 18 | } 19 | ]; 20 | -------------------------------------------------------------------------------- /examples/mean/src/app/contact/contact.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ContactComponent } from './contact.component'; 4 | 5 | describe('ContactComponent', () => { 6 | let component: ContactComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [ContactComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(ContactComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean/src/app/contact/contact.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-contact', 5 | standalone: true, 6 | imports: [], 7 | template: ` 8 |

9 | Welcome to the Contact Page! Here you will find all the information you need to get in touch with us. 10 |

11 | `, 12 | styles: `` 13 | }) 14 | export class ContactComponent { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/mean/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [HomeComponent] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(HomeComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/mean/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | standalone: true, 6 | imports: [], 7 | template: ` 8 |

9 | Welcome to the Homepage! Here you will find all the information you need to get started with the MEAN stack. 10 |

11 | `, 12 | styles: `` 13 | }) 14 | export class HomeComponent { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/mean/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mean 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/mean/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { AppComponent } from './app/app.component'; 4 | 5 | bootstrapApplication(AppComponent, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/mean/src/proxy.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "/api": { 3 | "target": "http://localhost:3000", 4 | "secure": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/mean/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | font-family: 'Roboto', sans-serif; 4 | margin: 0; 5 | padding: 0; 6 | } -------------------------------------------------------------------------------- /examples/mean/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/mean/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "outDir": "./dist/out-tsc", 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "sourceMap": true, 15 | "declaration": false, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "bundler", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "enableI18nLegacyMessageIdFormat": false, 29 | "strictInjectionParameters": true, 30 | "strictInputAccessModifiers": true, 31 | "strictTemplates": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/mean/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | --------------------------------------------------------------------------------