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
function returnNever(i: number): never { | |
// Logic here | |
if (i === 0) { | |
throw Error("i is zero"); | |
} else { | |
throw Error("i is not zero"); | |
} | |
// Will never reach the end of the function | |
} |
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
enum Weather { | |
Sunny, | |
Cloudy, | |
Rainy, | |
Snowy | |
} | |
let today: Weather = Weather.Cloudy; | |
let tomorrow: Weather = 200; | |
console.log("Today value", today); // Today value Cloud | |
console.log("Today key", Weather[today]); // Today key undefined |
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
interface Book { | |
type: "book"; | |
isbn: string; | |
page: number; | |
} | |
interface Movie { | |
type: "movie"; | |
lengthMinutes: number; | |
} | |
let hobby: Movie = { type: "movie", lengthMinutes: 120 }; |
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
interface MyCustomTypeA { | |
test: string; | |
} | |
interface MyCustomTypeB { | |
anything: boolean; | |
} | |
interface ReusableInterface3<T> { | |
entity: T; |
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
# Run `docker-compose build` to build the images | |
# Run `docker-compose up` to run the containers | |
# Run `docker-compose down` to remove the containers | |
version: '3.5' | |
services: | |
mysql: | |
container_name: service_mysql | |
image: mysql:5.7 | |
volumes: | |
- ~/datadir/mysql:/var/lib/mysql |
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
# Run `docker-compose build` to build the images | |
# Run `docker-compose up` to run the containers | |
# Run `docker-compose down` to remove the containers | |
version: '3.5' | |
services: | |
mysql: | |
container_name: service_mysql | |
image: mysql:5.7 | |
volumes: | |
- ~/datadir/mysql:/var/lib/mysql |
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:carbon | |
# Create app directory | |
WORKDIR /usr/src/app | |
# Bundle app source | |
COPY ./package.json . | |
# npm install | |
RUN apt-get update && npm install |
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
const mysql = require('mysql2/promise'); | |
const config = { | |
user: 'root', | |
password: 'root', | |
database: 'testdb', | |
host: 'mysql', | |
connectTimeout: 80000, | |
}; | |
mysql.createConnection(config) | |
.then((connection) => { |
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
ssl_certificate /etc/nginx/ssl/pac.crt; | |
ssl_certificate_key /etc/nginx/ssl/pac.key; | |
server { | |
server_name ms-commerce.com; | |
listen 80; | |
listen 443 ssl; | |
location / { | |
proxy_pass http://ms_commerce_client:3003; | |
proxy_http_version 1.1; |
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.5' | |
services: | |
gateway: | |
image: nginx:1.11 | |
ports: | |
- 80:80 | |
- 443:443 | |
volumes: | |
- ./proxy/default.conf:/etc/nginx/conf.d/default.conf:ro | |
- ./proxy/ssl:/etc/nginx/ssl:ro |