Skip to content

Instantly share code, notes, and snippets.

View prateekkathal's full-sized avatar
🦁
NestJS

Prateek Kathal prateekkathal

🦁
NestJS
View GitHub Profile
@prateekkathal
prateekkathal / Dockerfile
Last active June 18, 2021 18:50
For Medium Article - Using Docker with NestJS (or any NodeJS app)
FROM node:14.17.0-alpine
LABEL maintainer="dev@crowdlinker.com"
# Create app directory
WORKDIR /var/www/backend
# Install app dependencies - For NPM use: `COPY package.json package-lock.lock ./`
COPY package.json yarn.lock ./
# For NPM use: `RUN npm ci`
@prateekkathal
prateekkathal / docker-compose.yml
Created June 18, 2021 18:37
For Medium Article - Using Docker with NestJS (or any NodeJS app)
version: "3.7"
services:
backend:
container_name: myapp_backend
restart: always
build: .
environment:
- APP_ENV=development
- APP_PORT=9000
@prateekkathal
prateekkathal / .dockerignore
Created June 18, 2021 18:23
For Medium Article - Using Docker with NestJS (or any NodeJS app)
# Env files
.env
# Compiled output
/dist
/dist-seeder
/node_modules
# Logs
logs
@prateekkathal
prateekkathal / users.controller.ts
Created June 2, 2021 21:31
For Medium Article (Creating/Writing/Downloading Files in NestJS)
// This file should exist in `src/models/users`
import { UsersService } from "./users.service";
import { Response as ExpressResponse } from "express";
import { Controller, Get, Response } from "@nestjs/common";
/**
* Controller dealing with user entity based operations.
*
* @class
*/
@prateekkathal
prateekkathal / users.service.ts
Last active September 12, 2022 21:30
For Medium Article (Creating/Writing/Downloading Files in NestJS)
// This file should exist in `src/models/users`
import { parse } from "json2csv";
import { Injectable, NotFoundException } from "@nestjs/common";
import {
getFile,
createFile,
checkIfFileOrDirectoryExists,
} from "./../../common/helpers/storage.helper";
/**
@prateekkathal
prateekkathal / storage.helper.ts
Last active September 12, 2022 21:31
For Medium Article (Creating/Writing/Downloading Files in NestJS)
// This file should exist in `src/common/helpers`
import fs from 'fs';
import { promisify } from 'util';
/**
* Check if a file exists at a given path.
*
* @param {string} path
*
* @returns {boolean}
@prateekkathal
prateekkathal / config.yml
Created September 9, 2020 19:19
CircleCI config to build & deploy to AWS EBS/EC2
version: 2.1
aliases:
- &restore-cache
restore_cache:
name: Restore Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
- &install-deps
run:
name: Install dependencies
@prateekkathal
prateekkathal / data.ts
Created August 14, 2019 14:50
Seeding Databases Using NestJS
export const languages: ILanguage[] = [
{ name: 'English' },
{ name: 'French' },
{ name: 'Spanish' },
{ name: 'Russian' },
// ... and others ...
];
@prateekkathal
prateekkathal / index.html
Last active September 26, 2017 03:50
Default index.html for Apache v2.4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Modified from the Debian original for Ubuntu
Last updated: 2014-03-19
See: https://launchpad.net/bugs/1288690
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache2 Ubuntu Default Page: It works</title>