Skip to content

Latest commit

 

History

History
76 lines (60 loc) · 1.45 KB

File metadata and controls

76 lines (60 loc) · 1.45 KB

2a5 API

Development

You need to install on your local workstation:

  • git
  • nodejs
  • npm
  • docker

Prepare your local config:

cp ./.env.development.template ./.env.development.local

Do changes in ./.env.development.local now.

Install your environment

npm install

Generate the typescript prisma client:

npm run prismagenerate

Push all migrations to the postgresql database. This is only needed on first start when docker volume is initially created.

npm run prismadbpush

Run the nodejs development server:

npm run dev

Happy coding. API is available at http://localhost:3000/api Check your API via curl:

source ./.env.development.local && curl localhost:3000/api/token/correct -H "Accept: application/json" -H "Authorization: Bearer ${API_BEARER_TOKEN}"

Expected response: {"message":"success"}

If you do changes to the database schema run (while db is up)

npm run prismamigratedev

Stop it with CTRL+C

Dry Run App Building

npm run build
npm run start

Testing

Run Cypress tests (make sure db docker and local node server are running)

Warning: This command truncates your table content!

npm run test

Linting

Run to check for linting errors:

npx eslint .

Cleanup locally

Delete all generated files

rm -rf .next/ node_modules/ next-env.d.ts cypress/screenshots/ cypress/videos/ generated/