Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide adequate HTTP module documentation or another way #10589

Closed
2 of 15 tasks
UsVfxArtia opened this issue Nov 23, 2022 · 1 comment
Closed
2 of 15 tasks

Provide adequate HTTP module documentation or another way #10589

UsVfxArtia opened this issue Nov 23, 2022 · 1 comment
Labels
needs triage This issue has not been looked into

Comments

@UsVfxArtia
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Is there more detailed documentation about HTTPModule? I absolutely do not understand how to make a post request
Why is url, data and config required in brackets if url and data are in config?

https://docs.nestjs.com/techniques/http-module

The standard Axios just doesn't work...
Node-fetch is still experimental and constantly bugs...

In short - I'm building a service that makes a request to someone else's api and writes the received data to the database

Minimum reproduction code

https://docs.nestjs.com/techniques/http-module

Steps to reproduce

  1. just read this page...

Expected behavior

Full documentation with an example of using all query methods

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

9.2.0

Packages versions

{
  "name": "rest-nestjs",
  "version": "0.0.1",
  "private": true,
  "description": "",
  "license": "LICENSED",
  "author": "",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/src/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "jest": {
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testEnvironment": "node",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    }
  },
  "dependencies": {
    "@nestjs/axios": "^1.0.0",
    "@nestjs/common": "9.2.0",
    "@nestjs/core": "9.2.0",
    "@nestjs/platform-express": "9.2.0",
    "@nestjs/schedule": "^2.1.0",
    "@prisma/client": "4.6.1",
    "async": "^3.2.4",
    "axios": "^1.1.3",
    "got": "^12.5.3",
    "nest-schedule": "^0.6.4",
    "node-fetch": "^3.3.0",
    "reflect-metadata": "0.1.13",
    "rimraf": "3.0.2",
    "rxjs": "7.5.7"
  },
  "devDependencies": {
    "@nestjs/cli": "9.1.5",
    "@nestjs/schematics": "9.0.3",
    "@nestjs/testing": "9.2.0",
    "@types/async": "^3.2.15",
    "@types/cron": "^2.0.0",
    "@types/express": "4.17.14",
    "@types/jest": "29.2.3",
    "@types/node": "18.11.9",
    "@types/supertest": "2.0.12",
    "@typescript-eslint/eslint-plugin": "5.43.0",
    "@typescript-eslint/parser": "5.43.0",
    "eslint": "8.28.0",
    "eslint-config-prettier": "8.5.0",
    "eslint-plugin-prettier": "4.2.1",
    "jest": "29.3.1",
    "prettier": "2.7.1",
    "prisma": "4.6.1",
    "supertest": "6.3.1",
    "ts-jest": "29.0.3",
    "ts-loader": "9.4.1",
    "ts-node": "10.9.1",
    "tsconfig-paths": "4.1.0",
    "typescript": "4.9.3"
  },
  "prisma": {
    "seed": "ts-node prisma/seed.ts"
  }
}

Node.js version

18.12.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@UsVfxArtia UsVfxArtia added the needs triage This issue has not been looked into label Nov 23, 2022
@notusertelken
Copy link

the referenced doc page states "Axios is richly featured HTTP client package that is widely used. Nest wraps Axios and exposes it via the built-in HttpModule. The HttpModule exports the HttpService class, which exposes Axios-based methods to perform HTTP requests."

This means that the HttpService class has the axios library methods that have the same signature. So as showed in the docs, you can just inject the HttpService and call axios methods on it. As this is a wrapper (as many components of nest are), the docs don't copy the full documentation of the wrapped library, but just a simple example leaving the rest of the docs to be read on the wrapped library's docs (axios in this case)

check https://axios-http.com/docs/api_intro

@nestjs nestjs locked and limited conversation to collaborators Nov 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

3 participants