This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
product = { | |
'name': 'Burger', | |
'description': 'The tastiest burger ever' | |
} | |
try: | |
print(f"{product['name']} costs {product['price']}") | |
except KeyError: | |
print('There is no product\'s name and price') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
product = { | |
'price': 2000, # remove this to run the exception handling | |
'name': 'Burger', | |
'description': 'The tastiest burger ever' | |
} | |
try: | |
print(f"{product['name']} costs {product['price']}") | |
except: | |
print('There is no product\'s name and price') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
product = { | |
'price': 2000, | |
'name': 'Burger', | |
'description': 'The tastiest burger ever' | |
} | |
if 'name' in product and 'price' in product: | |
print(f"{product['name']} costs {product['price']}") | |
else: | |
print('There is no product\'s name and price') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
server: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
container_name: server | |
image: server | |
restart: always | |
volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
docker-compose build | |
up: | |
docker-compose up | |
run: | |
docker-compose up --build | |
down: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
server: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
container_name: server | |
image: server | |
restart: always | |
volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node | |
WORKDIR /usr/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . ./ | |
EXPOSE 5000 | |
CMD npm run dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"build": "tsc", | |
"dev": "eslint --fix --ext .ts ./src && nodemon", | |
"lint": "eslint --fix --ext .ts ./src" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"watch": ["src"], | |
"ext": "ts, json", | |
"exec": "tsc && node ./build/index.js" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"build": "tsc", | |
"dev": "node ./build/index.js", | |
"lint": "eslint --fix --ext .ts ./src" | |
}, |