1) Install NodeJS
On the 'Tools for Native Modules' screen check 'Automatically install the necessary tools....'
Make sure that all VSCode and Visual Studio windows are closed, and all node processes are closed. When the NodeJS installer is finished, a terminal will popup. Press enter on the terminal to start the build tools installation process.
npm install @angular/cli@latest -g
npm install -g nodemon
npm install
to add the needed files into the node_modules folder
Install MongoDB. Create the folder structure
C:\data\db\
To start the MongDB server, open up a new terminal and run the following. The path will look something like this but may look different depending on version number and where you installed files (these commands are for windows powershell)
"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
To connect to the MongoDB server, open up another terminal and run the following (these commands are for windows powershell)
"C:\Program Files\MongoDB\Server\3.4\bin\mongo.exe"
In the terminal where you have connected to the server, run
use lazywebapp
db.createUser ({user:'lazywebapp',pwd:'password', roles:[{role:'dbAdmin', db:'lazywebapp'}]})
7) In the project, create a new file called '.env' in root and copy into this new file, the contents of '.env.example' which can be found in the lazy web app project.
npm run dev
9) Open localhost:4200 or localhost:3000 in your browser. You should see a basic Angular app displayed. You are now running a local server.
Alternatively, instead of using 'npm run dev' you can run your project this way
In your project (lazywebapp) terminal, run
ng build
to compile the Angular front-end components into the dist
folder
Then run
node server.js
After doing the above:
5) Install the Google Cloud SDK
gcloud init
gcloud config set compute/region us-central1
Set the whitelist, IP to:
0.0.0.0/0
such that any Google server can access the
Create a user and a hard password.
Update the .env file
ng build --prod
gcloud app deploy
Deployed service [default] to [https://test-project-197703.appspot.com]
this page, do NOT follow the instructions.
email.service.js
file.
that the installation works.
// npm install --save ng-pwa-tools not actually used in this process // Note: there are errors indicating missing peer dependencies. At this point, we are ignoring the errors.
Add the following to package.json in the scripts
array.
// "ngu-sw-manifest": "node ./node_modules/ng-pwa-tools/bin/ngu-sw-manifest.js"
npm run ngu-sw-manifest --module src/app/app.module.ts --out dist/ngsw-manifest.json
The ngu-sw-manifest
command goes through the router in Angular, and copies all the routes, and uses it to generate a ngsw-manifest.json
file.
NOTE: If the above doesn't work and you're on Windows, it is probably because you are not using bash. More recent versions of Windows contain bash, just press the Windows key, type Windows Features
, then select Windows Subsystem for Linux
. Restart, then install Ubuntu form the Microsoft Store. When Ubuntu is setup, run, from the command line
bash
More information on how to do this here.
ngu-app-shell --module src/app/app.module.ts --url /loading --insert-module src/app/loading/module.ts
This project was generated with Angular CLI version 1.7.3.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
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
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.