Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2016-05-20 09:58:08

sahay223
Member
Registered: 2016-05-20
Posts: 1

How to use a site to work on localhost with the help of node.js?

I am learning node.js where i am trying to use learn it. I have tried using request and cheerio but i am getting only html page and no any css or js page (if there) and when i click any of its link does not jump to that page it redirect to old page only so how i can redirect it to that link in my localhost only. Is this code is wrong or how i can reach to my goal please need help?


var httpobj = require('http');
var request = require('request');
var cheerio = require('cheerio');
var all_html;
var url = 'http://w3cindia.in'

request(url, function (error, response, html) {
var $page = cheerio.load(html);
all_html = $page("html");   
});


httpobj.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});         
res.write(all_html + ' ');
res.end('');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');

Offline

#2 2016-05-20 10:05:22

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: How to use a site to work on localhost with the help of node.js?

Hi,
sorry I cannot give support for made work LHC in localmode.
You should try online for see if you have the same issue.

Please also consider sometimes you can have issue in make LHC works from local to online,
if you have issue my suggestion is to install directly from online.

Have a great time,
I AM sorry to be unable to help you with this. I can provide only free limited basic support.


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

Board footer