express.js with typescript

reference: https://github.com/microsoft/TypeScript-Node-Starter

First, initialize the project

install packages

npm install express
npm install @types/express --save-dev

If you meet a problem, TypeError: (0 , express_1.default) is not a function.

add “esModuleInterop”: true to compilerOptions in tsconfig.json

TS1259: Module '"F:/test/project/express-ts/node_modules/@types/express/index"' can only be default-imported using the 'esModuleInterop' flag

https://stackoverflow.com/a/34520891 import express = require(‘express’) import express from ‘express’;