Skip to content

Instantly share code, notes, and snippets.

@xgenvn
Forked from GuillaumeDesforges/.vscode_launch.json
Created February 4, 2021 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgenvn/6d6948464fbb456dc0ad20d5f1ecbb4b to your computer and use it in GitHub Desktop.
Save xgenvn/6d6948464fbb456dc0ad20d5f1ecbb4b to your computer and use it in GitHub Desktop.
Simplest use of TypeScript for node development with VS Code
{
// 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": [
{
"name": "Run server (dev)",
"type": "node-terminal",
"request": "launch",
"command": "yarn dev",
"cwd": "${workspaceFolder}"
}
]
}
{
"name": "yourpackage",
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT",
"private": true,
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "ts-node-dev --inspect=4321 --respawn --transpile-only src/index.ts"
},
"dependencies": {
"express": "4.17.1",
"typescript": "4.1.3",
"@types/express": "4.17.11"
},
"devDependencies": {
"ts-node-dev": "1.1.1"
}
}
import express from "express";
const app = express();
app.get("/", async (req, res) => {
res.send("Hello world!");
});
app.listen(3000);
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"removeComments": true,
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": false,
"noImplicitThis": false
},
"include": ["./src"],
"exclude": ["./node_modules"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment