Skip to content

Instantly share code, notes, and snippets.

View tkssharma's full-sized avatar
🎯
only JS

codewithtkssharma tkssharma

🎯
only JS
View GitHub Profile
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
}
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
interface Book {
type: "book";
isbn: string;
page: number;
}
interface Movie {
type: "movie";
lengthMinutes: number;
}
let hobby: Movie = { type: "movie", lengthMinutes: 120 };
interface MyCustomTypeA {
test: string;
}
interface MyCustomTypeB {
anything: boolean;
}
interface ReusableInterface3<T> {
entity: T;
# 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
# 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
FROM node:carbon
# Create app directory
WORKDIR /usr/src/app
# Bundle app source
COPY ./package.json .
# npm install
RUN apt-get update && npm install
const mysql = require('mysql2/promise');
const config = {
user: 'root',
password: 'root',
database: 'testdb',
host: 'mysql',
connectTimeout: 80000,
};
mysql.createConnection(config)
.then((connection) => {
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;
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