Skip to content

Minimal express app written in typescript with npm scripts to run the app in the vscode debugger

Notifications You must be signed in to change notification settings

mjgs/minimal-express-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimal-express-typescript

Minimal express app written in typescript that includes npm scripts to lint, compile and copy assets to dist directory and the ability to run the app in the vscode debugger.

Setup

npm install
npm start

Browse to http://localhost:3000 and http://localhost:3000/users/:user

Debugging

  1. Create vscode debug config .vscode/launch.json
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "npm run debug:start",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run-script",
        "debug:start"
      ],
      "port": 9229,
      "outputCapture": "std"
    }
  ]
}
  1. Set a breakpoint in the top of ./src/app.ts
  2. Click run
  3. Select "npm run debug:start" from the dropdown
  4. Click play

Credits

I got a lot of information for this setup from several different articles:

General express / typescript articles:

Use TypeScript to Build a Node API with Express

TypeScript Express tutorial

How (and why) you should use TypeScript with Node and Express.

How to set up an Express.js API using Webpack and TypeScript.

Create a server with Nodemon + Express + Typescript

With VSCode debug instructions:

Visual Studio Code: Node.js with TypeScript and Debugging

Debugging TypeScript in VS Code without compiling, using ts-node

Debugging Node.js apps in TypeScript with Visual Studio Code

How to Debug Nodejs, TypeScript Code in VSCode

About

Minimal express app written in typescript with npm scripts to run the app in the vscode debugger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published