Click here to Skip to main content
15,920,109 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionNode js Reading HTML page Pin
Member 1304854330-Mar-17 0:31
Member 1304854330-Mar-17 0:31 
I am trying to create a webpage using node js. In below code I am reading HTML file using readFile(file name,callback function(err,data)) method. But it is giving error message that
'Contents you are looking are Not Found'.I am doing in the VS 15 but when i execute same program in node js command prompt i can display the content.It would be grate help,If anybody can give any valuable suggestion.
var http = require('http');
var uwp = require("uwp");
uwp.projectNamespace("Windows");
var fs = require('fs');
http.createServer(function (req, res) {
if (req.url === "/create") {
fs.readFile('AppPages/product.html',function(err,data){
if (err) {
res.writeHead(404);
res.write('Contents you are looking are Not Found');
} else {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(data);
}
res.end();
});
}
else {
res.writeHead(200, { 'content-type': 'text/html' });
res.write('

Welcome to this page



to create product please enter: ' + req.url);
res.end();
}
}).listen(1337);
console.log('Server Started listening on 1337');
uwp.close();
QuestionHow to implement a custom javascript type to act like a dictionary ? Pin
Izis29-Mar-17 10:54
Izis29-Mar-17 10:54 
QuestionIs this closure correct ? Pin
Izis29-Mar-17 7:27
Izis29-Mar-17 7:27 
AnswerRe: Is this closure correct ? Pin
Richard Deeming29-Mar-17 7:49
mveRichard Deeming29-Mar-17 7:49 
GeneralRe: Is this closure correct ? Pin
Izis29-Mar-17 8:56
Izis29-Mar-17 8:56 
QuestionPrint HTML file using ActiveX Pin
Christopher Cote27-Mar-17 3:36
Christopher Cote27-Mar-17 3:36 
SuggestionRe: Print HTML file using ActiveX Pin
Richard Deeming27-Mar-17 7:49
mveRichard Deeming27-Mar-17 7:49 
QuestionDynamicaly Created Controls using Javascripted is not posting while submitting theform Pin
Member 1308703727-Mar-17 2:12
Member 1308703727-Mar-17 2:12 
AnswerRe: Dynamicaly Created Controls using Javascripted is not posting while submitting theform Pin
F-ES Sitecore28-Mar-17 22:41
professionalF-ES Sitecore28-Mar-17 22:41 
QuestionElements hidden - if visible do something Pin
Member 1307408621-Mar-17 3:42
Member 1307408621-Mar-17 3:42 
QuestionRe: Elements hidden - if visible do something Pin
ZurdoDev21-Mar-17 4:19
professionalZurdoDev21-Mar-17 4:19 
AnswerRe: Elements hidden - if visible do something Pin
Member 1307408621-Mar-17 4:34
Member 1307408621-Mar-17 4:34 
GeneralRe: Elements hidden - if visible do something Pin
ZurdoDev27-Mar-17 1:59
professionalZurdoDev27-Mar-17 1:59 
Questiondataset with java Pin
Member 1307317120-Mar-17 22:01
Member 1307317120-Mar-17 22:01 
AnswerRe: dataset with java Pin
Richard MacCutchan20-Mar-17 23:06
mveRichard MacCutchan20-Mar-17 23:06 
QuestionDisplay PDF in iframe from base64 string using blob url Pin
ankit1819-Mar-17 6:03
ankit1819-Mar-17 6:03 
SuggestionRe: Display PDF in iframe from base64 string using blob url Pin
ZurdoDev20-Mar-17 1:15
professionalZurdoDev20-Mar-17 1:15 
QuestionA more efficient approach? Pin
samflex10-Mar-17 3:54
samflex10-Mar-17 3:54 
AnswerRe: A more efficient approach? Pin
Nathan Minier16-Mar-17 4:41
professionalNathan Minier16-Mar-17 4:41 
GeneralRe: A more efficient approach? Pin
samflex17-Mar-17 3:01
samflex17-Mar-17 3:01 
AnswerRe: A more efficient approach? Pin
ZurdoDev16-Mar-17 5:38
professionalZurdoDev16-Mar-17 5:38 
QuestionOK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 6:43
professionalKevin Marois8-Mar-17 6:43 
AnswerRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:06
mveRichard Deeming8-Mar-17 8:06 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:08
professionalKevin Marois8-Mar-17 8:08 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:10
mveRichard Deeming8-Mar-17 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.