Skip to content

Instantly share code, notes, and snippets.

@noam-honig
noam-honig / tasks.json
Created March 22, 2021 17:28
Vs Code Config to run dev-ng and dev-node together
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev-ng",
"problemMatcher": [
"$tsc-watch"
],
"label": "npm: dev-ng",
@deejayy
deejayy / CustomModuleLoader.ts
Last active September 21, 2022 20:26
Solves the problem with typescript->javascript compilation and module path aliases (compilerOptions.paths).
import customModuleLoader = require('module');
export class CustomModuleLoader {
public cOptions: any = require('../tsconfig.json').compilerOptions;
public replacePaths: any = {};
constructor() {
Object.keys(this.cOptions.paths).forEach(alias => {
this.replacePaths[alias.replace(/\*.?/, '(.*)')] = this.cOptions.paths[alias][0].replace(/\*.?/, '$1');
@Maqsim
Maqsim / 413-payload-too-large-fix.js
Last active May 21, 2024 12:23
HOW TO FIX "413 Payload too large" in NodeJS (Express)
const express = require('express');
const bodyParser = require('body-parser');
...
// Express 4.0
app.use(bodyParser.json({ limit: '10mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
// Express 3.0