This app is built on Node.js framework Express.
There is .pdf documentation in docs folder
Before you start you need to have Postgres database running locally so install it.
In pgAdmin create new database with name kupaliska and owner postgres.
CREATE DATABASE kupaliska;
CREATE USER postgres WITH PASSWORD 'password';
GRANT ALL ON DATABASE kupaliska TO postgres;
ALTER DATABASE kupaliska OWNER TO postgres;
Install dependencies:
npm install
Copy the .env.example
file as .env
.
Then fill these variables:
Variable | Description |
---|---|
HOST |
FULL API URL including protocol, host and port |
PORT |
API port (should be same as in previous variable) |
CORS_ORIGINS |
Array of FULL URLS from where client app can request |
Then you need to fill or replace these database variables:
POSTGRES_USER
- usernamePOSTGRES_PASSWORD
- passwordPOSTGRES_DB
- database name (it must exists)
To make payment gateway work you need to fill the following variables. To get them, please contact Martin Pinter or Patrik Kadlcik
GP_WEBPAY_HTPP_API_URL
GP_WEBPAY_MERCHANT_NUMBER
GP_WEBPAY_CURRENCY
GP_WEBPAY_KEYS_PATH
GP_WEBPAY_PRIV_KEY_PASS
GP_WEBPAY_CLIENT_APP_URL
GP_WEBPAY_PROVIDER
We're using turnstile. In case that it is needed TURNSTILE_SECRET_KEY
can be found in [Cloudflare] (https://www.cloudflare.com) page under section Turnstile
. From there use the kupaliska.bratislava.sk
site.
To make emails work, all of the following variables must be set but you also have to be set in authorized recipients here and when you are making order, enter the exact email.
MAILGUN_HOST
- Mailgun domain hostMAILGUN_DOMAIN
- Domain from which emails are sentMAILGUN_EMAIL_FROM
- From which email emails are sentMAILGUN_TEMPLATE_RESET_PASSWORD
- Name of the template for password resetMAILGUN_TEMPLATE_ORDER
- Name of the template for orderMAILGUN_TEMPLATE_SET_PASSWORD
- Name of the template for password set
Run migrations and seeders:
npm run migrate:dev
npm run seed:dev
npm run start
or
npm run debug
The app can be deployed by standard means through bratiska-cli.
To create apidoc run:
npm run apidoc:scan
Apidoc will be available on /apidoc, only in development environment.
To run tests create .env.test file. It`s important to set at least this dotenv variables
GP_WEBPAY_KEYS_PATH=resources/placeholder-test-keys
and direct POSTGRES variables to your test DB.
Then you should be able to simply run:
npm run test
or
npm run test:coverage
App is using i18next translation package. For running scanner use:
npm run translate:scan
It will NOT rewrite your current translations.