- Production Server Port :
5100
tcp - Dev Server Port :
3000
tcp - Production Data Base :
mongodb://localhost:27017/iCantina
- Production Data Base (inside docker) :
mongodb://mongo:27017/iCantina
- Dev Data Base :
mongodb://localhost:27017/testiCantina
- Dev Data Base (inside docker) :
mongodb://mongo:27017/testiCantina
-
-
There is a docker for development, the configuration for this docker is into docker-compose.dev.yml and Dockerfile-dev, the way to start it is with the following command:
docker-compose -f docker-compose.dev.yml up --build
-
Once the docker is up, you can try to make calls to the api using this address: http://localhost:3000
-
To show changes on real time and acive the live reload you need install and start typescript :
-
Install typescript:
npm install -g typescript
Remember that you need administrator privileges to install npm packages globally
-
Start typescript compiler on watch mood:
tsc -w
-
-
-
To run tests you need to run
npm test
from local machine. Also you can run test into docker shell, for this you need to change value of database_ip variable to database_ip_docker into config.ts file, this variable contains the database address used on tests.
-
-
There is a docker for production, the configuration for this docker is into docker-compose.yml and Dockerfile, the way to start it is with the following command:
docker-compose up --build
-
Once the docker is up, you can try to make calls to the rest api using this address: https://localhost:5100
-
-
-
There is a configuration file for production, config-prod.ts, in this file you can configure the parameter for your rest api:
-
isHttps: this is a boolen to set if use https, for default is true and use my cert files, you need to change privkey.pem, cert.pem and chain.pem files to your certificates files for enable https and make it works.
-
oauth2Credentials: this object contains the parameter to configure google authentication, for default you have mi api credentials, be carreful 😉 .
-
-
-
-
You can configure docker settings into docker-compose.yml and Dockerfile files:
-
There are 2 volumes created to save the persistant data , one for the product images and other for the database, the default path for them is:
- Product images:
/opt/iCantina/product_img/uploads
- Database:
/opt/iCantina/product_img/uploads
To configure them you can do it on docker-compose.yml if the indicated paths not exist it will not work
- Product images:
-
-