A geo-location based game for exploration
- NestJS
- TypeScript
- Prisma
- Postgres (production)
- Heroku
- Heroku Postgres
- EJS View Engine
- HTTPS redirect
- Helmet (better headers)
- Enable CORS -Cross-origin resource sharing (CORS)
- csurf for CSRF/XSRF
- csurf requires Express Session
- Rate Limits
- GitHub new repo, with README, .gitignore (Node), license
- Clone down to local machine
- Open PS in repo.
- Move to parent folder, mk dir temp.
- cd into temp, run nest new findit.[1]
- Let it run, copy files into my repo, not overwriting this README.
- Add install/run/test commands (from temp Nest README).
- Run locally:
- npm install
- npm run start
- Open browser to http://localhost:3000/
- Verify, then stop the app (CTRL-C CTRL-C)
- npm install --save dotenv
- Run locally (see above).
- Verify and stop.
- If needed, complete git setup. If TortoiseGit:
- settings / git / remote /
- add name and email
- settings / git / credential
- config type: local
- Helper: wincred
- Click Add New/Save, then Apply
- Git add / commit / push new content:
- git add .
- git commit -m "updates here"
- git push origin main
- nest generate resource location - answer prompts:
- REST API
- Y (yes, generate)
- Create favicon (e.g., Favicon.io)
- Text / Rounded / Orienta / 45 / #FFF / #F0F / Download (zip)
- Change default response to Express view
- npm install --save ejs
- Create ./public/images - add favicon zip contents
- Create ./public/styles - add style.css
- Create ./views with footer.ejs, header.ejs, index.ejs
- src/main.ts - enable Express, folders, view engine
- src/app.controller.ts - prepare for view response
- src/app.service.ts - provide view name (index)
- Heroku needs version in package.json and start script
- update package.json
- add Procfile (web: npm run start:prod)
- Add Prisma to support SQLite, Postgres, Atlas
npm install
npm run drop
npm run prisma:in
npm run db:push
npm run prisma:generate
npm run seed
# development
npm run start
# watch mode
npm run start:dev
# production mode
npm run start:prod
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
heroku update
heroku logs --app findit-nest --tail
heroku open --app findit-nest
heroku pg:psql postgresql-trapezoidal-45903 --app findit-nest
- Heroku login
- Optional: Heroku CLI
Create Heroku app with Heroku Postgres (Hobby Dev - free) add-on.
- Heroku / Apps / New / Create new app / set name / create
- Deploy method / GithHub / set to your repo / connect
- Automatic deploys / click "Enable Automatic Deploys"
- Heroku / This-Heroku-app / Overview / Configure addons / Find more addons / Heroku Postgres / Install Heroku Postgres / Hobby Dev-Free / findit-nest (use your app name) / Submit order form
- Heroku / This-Heroku-app / Settings / Reveal config vars (verify DATABASE_URL exists)
- Heroku / This-Heroku-app / Deploy / Manual deploy / "Deploy Branch"
- Heroku / This-Heroku-app / Overview / watch latest activity / View build progress (watch for any issues)
- Heroku / This-Heroku-app / Open app
- Errors? Heroku / This-Heroku-app / More / View logs
heroku logs -n 200 -a findit-nest
- Nest documentatation
- Nest MVC
- Stackoverflow TortoiseGit wincred - top answer
- Web App 2020 Fall
- Favicon.io
- Heroku Node.js Support
- โญ VS Code - SQLite extension
- Prisma Examples /ts/REST
- NestJS Prisma Recipe
- NestJS-Prisma-Starter
- Prisma Data Model
- Best practice for instantiating PrismaClient with Next.js
- Location of PrismaClient
- Nest Prisma CRUD
- Prisma Seeding
- Prisma Grading App
- Prisma: Single provider
- PWA