Use this starter app to initialize a full-stack app using:
- Node.js platform
- Express web framework
- EJS templating engine
- MVC design pattern
- Mongoose MongoDB object modeling
- Lodash for JavaScript object iteration and manipulation
- jQuery library for DOM manipulation
- BootStrap Material Design framework for responsive design
- Morgan HTTP request logger
- Winston multi-level logger that transports to log files
Following must be downloaded, installed, and configured according to the product directions:
- Node.js (comes with npm)
- Git version control system
- VS Code light-weight, cross-platform code editor or other IDE
- If Windows, TortoiseGit
- Add "Open PowerShell Here as Administrator" to context menu. Download and run file from https://github.com/profcase/open-command-window-here-as-admin.
- Fork this repo into your own cloud account.
- Clone your repo down to your local machine.
- Copy .env.example to .env
- Update .env with your information.
- Open PowerShell in root folder and run
npm install
to install dependencies. - Run
nodemon app.js
to start the server. - Open browser to the location displayed, e.g. http://localhost:3004/.
- Run MongoDB in the cloud - see https://www.mongodb.com/cloud/atlas
- app.js - Starting point for the application. Defines the express server, requires routes and models. Loads everything and begins listening for events.
- controllers/ - logic for handling client requests
- data/ - seed data loaded each time the application starts
- models/ - schema descriptions for custom data types
- routes/ - route definitions for the API
- utils/ - utilities
- views/ - EJS - embedded JavaScript and HTML used to create dynamic pages
- Bootstrap Material Design CDN
- JavaScript Standard Style Validator
- ESLint
- TravisCI
- Data Hosting with Atlas
- App Hosting with Google Cloud Platform
- GCP Eduction Credits for Faculty
- Choose a person to host your application code.
- Hoster should click on their Student Coupon Retrieval Link.
- Follow instructions to get an account.
- Install GCloud SDK
- Enable Cloud Build API and billing.
- Use the commands below to create a project - use your repo name.
- Then initialize an App Engine Application in the project - it will ask for a region. Choose one nearby with free option.
- package.json needs new dependency: @google-cloud/logging-winston
- package.json needs to set the node entry value to "^10"
- See app.yaml for suggested settings.
- After the app deploy command, you will get an error. Read the error and go to the URL provided to enable billing.
gcloud projects create node-express-mvc-ejs-start --set-as-default
gcloud projects describe node-express-mvc-ejs-start
gcloud app create --project=node-express-mvc-ejs-start
gcloud app deploy
gcloud app browse
When starting a new session, you'll have to log in again and then set the project.
gcloud config set project node-express-mvc-ejs-start
You should get some results that include something like the following.
descriptor: C:\44563\node-express-mvc-ejs-start\app.yaml
source: C:\44563\node-express-mvc-ejs-start
target project: node-express-mvc-ejs-start
target url: <https://node-express-mvc-ejs-start.appspot.com>