Sign inSign up

jmaclean/nodejs-angular-heroes

By jmaclean

โ€ขUpdated over 5 years ago

Image
0

215

jmaclean/nodejs-angular-heroes repository overview

CrossLogic logo โ 

Logo CrossLogic โ 

Logo Angular โ 

โ Angular Example App

Example app with Angular 8 + Angular CLI + Angular Universal + i18n + Firebase

:clap::clap::tada::tada::tada::tada::clap::clap:

Base project made with much :heart:. Contains CRUD, patterns, generated library, and much more!

LIVE DEMOโ 
Demo example โ 

Report bugโ  ยท Request featureโ 

โ Credits

This project is copied from angular8โ  and all credits for the content will go to the ones that deserved them :-)

โ Overview

This project will be used to develop and test CICD pipelines for OpenShift, Kubernetes, AWS, and other cloud platforms.

โ Usage

โ Development

The first section of the docker-compose.yml describes the development configuration. It runs node. The application should be developed from within the container to avoid any external dependencies.

docker-compose up
docker exec -ti nodejs-angular-heroes bash
cd /app
npm install
npm test
npm start

export CHROME_BIN=/app/node_modules/node_modules/chromium

http://localhost:4200โ 

โ Production

The first section of the docker-compose.yml describes how the CICD pipeline would build and test the application and make it ready for production. The application will eventually run on bare nginx only.


โ Original README from the source project

Files changed from the original project:

  • README.md
  • Dockerfile
  • Dockerfile.dev
  • docker-compose.yml
  • package.json
    • added --host 0.0.0.0 --port 4200 to start to be able to expose port
    • added devDependencies
      • "chromium": "2.1.1",
      • "protractor": "5.4.3", -> to be aligned with chrome 80 in Dockerfile:apt-get
  • protractor.conf.js
  • search/replace -> 3f51bxxxx5/3179be;
  • src/i18n/messages.en.xlf -> logo
  • src/app/shared/components/header/header.component.html -> logo

โ Table of contents

โ Status

travis Quality Gate Status Coverage dependency Status devDependency Status peerDependencies Status npm

GitHub stars GitHub forks

โ What's included

  • CRUD: create, update and remove heroes with Firebase
  • Angular Universal (SSR)
  • Use of prebootโ  module to share state between browser and server
  • Security Headers using helmetโ . Report hereโ .
  • Internationalization with the official i18n. Separated builds for english and spanish.
  • Lazy loading modules
  • Service Workers enabled!
  • Example of Angular Resolver for Hero Detail
  • More logical directory structure (from hereโ )
  • Basic example library
  • Following the best practicesโ !
  • Search bar, to look for heroes
  • Custom loading page
  • Lazy loading images with ng-lazyload-imageโ 
  • Modal and toasts (snakbar)!
  • Scroll restoration and anchor examples
  • Responsive layout (flex layout module)
  • SASS (most common used functions and mixins) and BEM styles
  • Animations with ng-animateโ 
  • Angular Pipes
  • Interceptors and Events (Progress bar active, if a request is pending)
  • Scroll to first invalid input in forms. (ngx-scroll-to-first-invalidโ )
  • Modernizr (browser features detection)
  • Browser filter (Bowser) because of IE ^^
  • Sentryโ ! (logs every error in the app)
  • Google Tag Manager
  • ES6 Promises and Observables
  • Unit tests with Jasmine and Karma including code coverage. Use of ng-bulletโ , karma-mocha-reporterโ  and ng-mocksโ 
  • End-to-end tests with Protractor
โ Angular Ivy

This project is using version 8 of angular but Ivy is not enabled. I'm trying to do it, but some errors appear during this process. I would accept any pull request about this because no one till now knows what to do...

โ Angular Universal and i18n

This project is deployed in firebase using Angular Universal and the official i18n. You can navigate through every language and reload (and share) every page in the application without losing context. This is very useful for SEO purposes and you almost have a ready for production app. If you want to translate the messages you can use this awesome tool, Tiny Translatorโ  or follow this tutorialโ .

I've created a medium post where you can find a tutorial to apply this concepts to your own project. Check it hereโ , and let me know what do you think.

โ Firebase

This repo is using Firebase. We use Cloud Firestore and Cloud Storage to handle CRUD operations over the heroes and to store their images. Also Hosting and Functions to deploy the app with Universal.

โ Travis CI

We use Travis CI to run this tasks in order:

  • Linter
  • Unit tests
  • End to end tests
  • Build for production of browser and server
  • Validate that server generated using curl
  • Sonar
  • Deploy to Firebase

โ Quick start

WARNING

Verify that you are running node 10.16.0 by running node -v in a terminal/console window. Older versions produce errors, but newer versions are fine.

npm i
npm start
TasksDescription
npm startStart the app in development mode with the english language only
npm start:esStart the app in development mode with the spanish language only
start:ssrStart the server like SSR
extract-i18nExtract all messages from templates and ts files and update the language files with new translations
npm run lintRun the linter (tslint)
npm run testRun all unit tests with karma and jasmine
npm run test:app:watchRun app unit tests and wait for changes
npm run test:library:watchRun library unit tests and wait for changes
npm run e2eRun end to end tests with protractor
npm run build:prod:enBuild the app for production with english translations
npm run build:prod:esBuild the app for production with spanish translations
npm run build:server:prodBuild the server version for production
npm run compile:serverCompiles the server with webpack
npm run build:ssrComplete task with all the build subtasks for SSR
npm run build:libraryBuild the library
npm run serve:ssrStart the node server for angular universal
npm run validate:serverScript that validate if server generated previously starts without error
npm run bundle-reportBuild and run webpack-bundle-analyzer over stats json
npm run release:minorCreate a new minor release using standard-version
npm run release:majorCreate a new major release using standard-version
npm run ciExecute linter, tests and production builds
npm run deployBuild the app and deploy it to firebase hosting

โ Bugs and feature requests

Have a bug or a feature request? Please first read the issue guidelinesโ  and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issueโ .

โ Contributing

Please read through our contributing guidelinesโ . Included are directions for opening issues, coding standards, and notes on development.

Moreover, all HTML and CSS should conform to the Code Guideโ , maintained by Ismael Ramosโ .

Editor preferences are available in the editor configโ  for easy use in common text editors. Read more and download plugins at https://editorconfig.org/โ .

โ Creators

Ismael Ramos

Buy Me A Coffee

โ Thanks

Thanks to all contributors and their support.

If you have an idea or you want to do something, tell me or just do it! I'm always happy to hear your feedback!

Code and documentation copyright 2018 the authors. Code released under the MIT Licenseโ .

Enjoy :metal:

Tag summary

Content type

Image

Digest

Size

37.2 MB

Last updated

over 5 years ago

docker pull jmaclean/nodejs-angular-heroes