Giter Club home page Giter Club logo

aprendiendo-ts-express's Introduction

Express with TypeScript

Initial config tsconfig

Install TypeScript

npm install typescript -D -E

Add tsc script to package.json

  "scripts": {
    "tsc": "tsc"
  }

This generates the code JS for prod

Init config tsc

npm run tsc -- --init

Add types express

npm install @types/express -D -E

Add dev mode

npm install ts-node-dev -D -E

Add dev script to package.json

  "scripts": {
    "dev": "ts-node-dev src/index.ts"
  }

Add Eslint with ts-standard

npm install ts-standard -D -E

  "scripts": {
    "lint": "ts-standard"
  }

and add in the packa.json:

  "eslintConfig": {
    "parserOptions": {
      "project": "./tsconfig.json"
    },
    "extends": [
      "./node_modules/ts-standard/eslintrc.json"
    ]
  }

Check if eslint is configured correctly

Start project

¿How does that work?

Require Node.js 18.x

  • npm install to install the dependencies
  • npm run dev to run development mode app
  • npm start to build production

https://blog.logrocket.com/how-to-set-up-node-typescript-express/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.