I have an ethereum node running in my system:
--rpc --rpcaddr "127.0.0.1" --rpcport "8000" --rpccorsdomain "*" --datadir "/home/Sample/Ethereum/Data/node1" --port "30303" --maxpeers 2 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3,solc" --rpcapi "db,eth,net,web3,personal" --networkid 1900 --nat "any" --unlock "0" --nodiscover console init ~/Ethereum/Data/node1/customgenesis.json
I am trying to connect to this node from nodejs using the following code:
var Web3 = require('web3');
var web3 =Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8000'));
console.log(web3.version.api)
but, I am getting this error
TypeError: Cannot read property 'version' of undefined
Can someone help me solve this issue?