Giter Site home page Giter Site logo

Comments (9)

dasoncheng avatar dasoncheng commented on August 28, 2024 1

From the configuration file, the problem may be that tedis is used on the front end

from tedis.

dasoncheng avatar dasoncheng commented on August 28, 2024

Developing a node program with typescript need @types/node. Please confirm whether it is a problem in this aspect 😊

from tedis.

josephwinston avatar josephwinston commented on August 28, 2024

from tedis.

dasoncheng avatar dasoncheng commented on August 28, 2024

The problem might be the version of @types/node, i just added working examples of js, es, and ts to the project.

You can refer to it or add "allowSyntheticDefaultImports": true to your tsconfig.json

from tedis.

tejalbhujbal avatar tejalbhujbal commented on August 28, 2024

@dasoncheng I am trying to use tedis, and am writing in my service.ts

const tedis = new Tedis({
        port: 6379,
        host: "127.0.0.1"
      }); 

but i am getting following error

ERROR TypeError: net_1.createConnection is not a function
    at Tedis.Base (base.js:46)
    at Tedis.Mixin (tools.js:20)
    at new Tedis (tedis.js:30)

Can you please guide on the same?

from tedis.

dasoncheng avatar dasoncheng commented on August 28, 2024

@tejalbhujbal Can you provide more information, such as tsconfig, package.json

from tedis.

tejalbhujbal avatar tejalbhujbal commented on August 28, 2024

Yes sure.
tsconfig

{
 "compileOnSave": true,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
 "allowJs": true,
 "allowSyntheticDefaultImports": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

package.json

{
  "name": "admin-cli-update",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0 --ec true --port 4201",
    "build": "ng build",
    "gitbuild": "ng build --base /start-angular/myApp/master/dist/",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "myApp": "http-server ./dist"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/flex-layout": "^6.0.0-beta.17",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@ngx-translate/core": "^10.0.2",
    "@ngx-translate/http-loader": "^3.0.1",
    "angular5-csv": "^0.2.10",
    "body-parser": "^1.17.2",
    "bootstrap": "^3.3.7",
    "chart.js": "^2.7.2",
    "connect-redis": "^3.3.2",
    "cookie-parser": "^1.4.3",
    "core-js": "^2.4.1",
    "cors": "^2.8.4",
    "express": "^4.16.4",
    "express-session": "^1.15.6",
    "font-awesome": "^4.7.0",
    "hiredis": "^0.5.0",
    "html2canvas": "^1.0.0-alpha.12",
    "http-server": "^0.11.1",
    "jquery": "^3.3.1",
    "jspdf": "^1.4.1",
    "jspdf-autotable": "^2.3.5",
    "ng2-bootstrap-modal": "^1.0.1",
    "ng2-charts": "^1.6.0",
    "ng2-pdf-viewer": "^5.0.1",
    "ngx-bootstrap": "2.0.5",
    "primeng": "^6.0.0-alpha.2",
    "redis": "^2.7.1",
    "redis-typescript": "^0.1.2",
    "request": "^2.83.0",
    "rxjs": "^5.5.2",
    "tedis": "^0.1.4",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.2",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "@types/redis": "^2.8.8",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  },
  "main": "karma.conf.js",
  "keywords": [],
  "author": "",
  "description": ""
}

from tedis.

tejalbhujbal avatar tejalbhujbal commented on August 28, 2024

@dasoncheng I want to connect to redis from my angular 4 application, for that reason I am trying to use tedis from my service file as mentioned in first comment. But its not working.
I went through documentation and as described "Tedis write with typescript, it's the client of redis for nodejs, support asycn with ts and commonjs".

So can you please tell me the appropriate way to use tedis?

from tedis.

dasoncheng avatar dasoncheng commented on August 28, 2024

@tejalbhujbal tedis is a tool for nodejs, work as a service on back-end. example

from tedis.

Related Issues (20)

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.