Online Ordering application using Nest framework, with React & Postgres.
node 14+ (from create-react-app requirement)
postgres database created
.env file populated
make sure citext extension is installed
-- in psql:
create extension citext;
create the database tables from prisma schema
npx prisma db push
seed database
# run from top level folder
npx knex seed:run --knexfile ./src/knexfile
create views
# run from top level folder
npx knex migrate:latest --knexfile ./src/knexfile.ts
npm install
# repeat inside client folder
# 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
Change the default ports!
Both nestjs and CRA use port 3000 as the default. Interestingly, both can be run at the same time if CRA is launched before nestjs. It seems as though nestjs(express/node) binds to all/any available interfaces, according to this. So what seems to be happening is that CRA binds to localhost and the ipv4 address first, and then nestjs binds to ipv6. It should be noted that CRA complains if nestjs is launched first, followed by CRA.
SKIP_PREFLIGHT_CHECK=true
The nestjs cli commands use versions of jest, eslint, etc that are newer than the version that CRA is using; This .env variable should be set in the CRA folder to stop CRA from complaining.
Issue source: related issue orig. issue
npx prisma db pull (--force)
npx prisma generate
# run from top level
-npx knex seed:run --knexfile ./src/knexfile
# set up husky
npm run prepare
# OSX - permissions might beed to be set for husky
# https://github.com/typicode/husky/issues/1177
chmod ug+x .husky/*