All Questions

Tagged with
Filter by
Sorted by
Tagged with
321 votes
33 answers
548k views

Render basic HTML view?

I have a basic Node.js app that I am trying to get off the ground using the Express framework. I have a views folder where I have an index.html file. But I receive the following error when loading the ...
aherrick's user avatar
  • 20k
247 votes
11 answers
238k views

Electron require() is not defined

I'm creating an Electron app for my own purpose. My problem is when I'm using node functions inside my HTML page it throws an error of: 'require()' is not defined. Is there any way to use Node ...
Mari Selvan's user avatar
  • 3,732
241 votes
23 answers
598k views

Loading basic HTML in Node.js

I'm trying to find out how to load and render a basic HTML file so I don't have to write code like: response.write('...<p>blahblahblah</p>...');
Just a guy's user avatar
  • 5,882
222 votes
8 answers
214k views

Best approach to real time http streaming to HTML5 video client [closed]

I'm really stuck trying to understand the best way to stream real time output of ffmpeg to a HTML5 client using node.js, as there are a number of variables at play and I don't have a lot of experience ...
deandob's user avatar
  • 5,200
214 votes
3 answers
173k views

HTML-parser on Node.js [closed]

Is there something like Ruby's nokogiri on nodejs? I mean a user-friendly HTML-parser. I'd seen on Node.js modules page some parsers, but I can't find something pretty and fresh.
asci's user avatar
  • 2,560
210 votes
3 answers
135k views

Good beginners tutorial to socket.io? [closed]

I am very new to the world of webdevelopment and jumped into the bandwagon because I find the concept of HTML5 very interesting. I am fairly confident on working with canvas and would now like to move ...
Shouvik's user avatar
  • 11.5k
160 votes
6 answers
329k views

Connecting to TCP Socket from browser using javascript

I have a vb.net application that opens a socket and listens on it. I need to communicate via this socket to that application using a javascript running on a browser. That is i need to send some data ...
swordfish's user avatar
  • 4,989
151 votes
16 answers
223k views

How do I use HTML as the view engine in Express?

I tried this simple change from the seed and created the corresponding .html files (e.g. index.html). //app.set('view engine', 'jade'); app.set('view engine', 'html'); and this file remained the ...
Julio's user avatar
  • 1,995
143 votes
4 answers
206k views

Node.js can't create Blobs? [duplicate]

I am working with node.js and I streamed my Audio to my node.js server. Now I noticed during the process of building the audio blob: var audioBlob = new Blob([dataview], { type: 'audio/wav' }); That ...
zer02's user avatar
  • 4,001
117 votes
8 answers
61k views

where to find or how to set htmlWebpackPlugin.options.title in project created with vue cli 3?

I wanted to set title to my webpage created with vue cli 3 and thus looked into public/index.html. There, I found <title><%= htmlWebpackPlugin.options.title %></title>. How do I set ...
Mayank Kumar Chaudhari's user avatar
112 votes
3 answers
154k views

Streaming a video file to an html5 video player with Node.js so that the video controls continue to work?

Tl;Dr - The Question: What is the right way to handle streaming a video file to an html5 video player with Node.js so that the video controls continue to work? I think it has to do with the way that ...
WebDeveloper404's user avatar
111 votes
6 answers
146k views

How do you import a javascript package from a cdn/script tag in React?

I'd like to import this javascript package in React <script src="https://cdn.dwolla.com/1/dwolla.js"></script> However, there is no NPM package, so I can't import it as such: ...
Jeremy Herzog's user avatar
108 votes
6 answers
92k views

Difference between jQuery vs. AngularJS vs. Node.js [closed]

I'm just starting web development, and so far I know: HTML - layout of website CSS - make it look pretty JavaScript - functionality Then what is jQuery, AngularJS, and Node.js? After doing a quick ...
K Split X's user avatar
  • 4,181
108 votes
13 answers
89k views

Using HTML in Express instead of Jade

How to I get rid of Jade while using Express with Node.JS? I want to just use plain html. In other articles I have seen that people recommended app.register() which is now deprecated in the latest ...
Sanchit Gupta's user avatar
106 votes
5 answers
143k views

Sending message to a specific connected users using webSocket?

I wrote a code for broadcasting a message to all users: // websocket and http servers var webSocketServer = require('websocket').server; ... ... var clients = [ ]; var server = http.createServer(...
Royi Namir's user avatar
  • 147k
96 votes
11 answers
165k views

How to add custom html attributes in JSX

There are different reasons behind it, but I wonder how to simply add custom attributes to an element in JSX?
Andrey Borisko's user avatar
90 votes
12 answers
177k views

DOM element to corresponding vue.js component

How can I find the vue.js component corresponding to a DOM element? If I have element = document.getElementById(id); Is there a vue method equivalent to the jQuery $(element)
Ghigo's user avatar
  • 1,677
75 votes
2 answers
56k views

What is the main use of the site.webmanifest file?

I am using a HTML Boilerplate and I see a file called site.webmanifest. I have searched information on the Internet and I don't understand the use of it. Is it a mandatory file in the development of ...
JusitoFelix's user avatar
71 votes
4 answers
111k views

how to use jQuery ajax calls with node.js

This is similar to Stream data with Node.js, but I don't feel that question was answered sufficiently. I'm trying to use a jQuery ajax call (get, load, getJSON) to transfer data between a page and a ...
briznad's user avatar
  • 912
62 votes
6 answers
63k views

Save and render a webpage with PhantomJS and node.js

I'm looking for an example of requesting a webpage, waiting for the JavaScript to render (JavaScript modifies the DOM), and then grabbing the HTML of the page. This should be a simple example with an ...
Harry's user avatar
  • 54.1k
58 votes
12 answers
126k views

Pass variable to html template in nodemailer

I want to send email with nodemailer using html template. In that template I need to inject some dynamically some variables and I really can't do that. My code: var nodemailer = require('nodemailer');...
Wacław Łabuda's user avatar
57 votes
6 answers
177k views

Node.js Generate html

I have created a JavaScript program which generates a list of data. Example output below: output one output two output three ... I would like to be able to generate a HTML file which can be saved ...
lufthansa747's user avatar
  • 1,973
55 votes
6 answers
177k views

Get element height with Vuejs

I want to get the height of a div in order to make the height of another div matching it. I used the method clientHeight, but It doesn't return me the good value (smaller value). Actually, It seems to ...
Juliane Blier's user avatar
54 votes
2 answers
54k views

What exactly does 'serving static files' mean?

So far I've always been developing my clientside applications without any of my own servers running behind it, using Webstorm's built-in webserver to serve my content. What I frequently see when ...
Robin-Hoodie's user avatar
  • 4,946
53 votes
2 answers
77k views

Can WebSocket addresses carry parameters?

Is ws://myserver.com/path?param=1 a valid WebSocket address ? The address http://myserver.com/path?param=1 (notice it's now http and not ws) works fine with wscat, but I can't get it working on the ...
João Pinto Jerónimo's user avatar
52 votes
3 answers
162k views

Connecting client to server using Socket.io

I'm relatively new to node.js and it's addons, so this is probably a beginnersquestion. I'm trying to get a simple HTML page on a webserver connect to a different server running node.js with ...
shmow's user avatar
  • 641
49 votes
2 answers
49k views

how to save canvas data to file

i am using node.js to save canvas to image img in writeFile is extractedby using toDataURL on my canvas element. it doenot save file here is my code var fs = IMPORTS.require('fs'); var path = ...
madiha.athar's user avatar
  • 1,113
47 votes
1 answer
64k views

How to handle POST request in node.js

I'm trying to handle a post request being sent to my node.js server. JavaScript file with a name server.js displays a form on the browser. I want access to the form values after they are posted to the ...
Sau's user avatar
  • 2,119
47 votes
9 answers
32k views

Sharing websocket across browser tabs?

We want to have one socket per browser rather than one per tab in a browser. How can we achieve it? I read about shared web workers which was promising. A reference for that too is appreciated. ...
singhsumit's user avatar
46 votes
2 answers
156k views

Node.js - How to send data from html to express

this is form example in html: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>CSS3 Contact Form</title> </head> <body> <div id="...
royb's user avatar
  • 703
46 votes
8 answers
77k views

Video streaming with HTML 5 via node.js

I'm trying to set up a web server that will support streaming video to an HTML5 video tag using node.js. Here's my code so far: var range = request.headers.range; var total = file.length; var parts ...
Chris Harrington's user avatar
45 votes
1 answer
32k views

How to escape HTML in node.js EJS view?

I want to escape the html in bloglist[i].Text field. How to do that with EJS? <!DOCTYPE html> <html> <head> <title><%= title %></title> <link rel='...
marko's user avatar
  • 10.9k
44 votes
4 answers
41k views

Streaming data with Node.js

I want to know if it is possible to stream data from the server to the client with Node.js. I want to post a single AJAX request to Node.js, then leave the connection open and continuously stream data ...
Saif Bechan's user avatar
  • 16.8k
42 votes
11 answers
47k views

How to set HTML lang attribute dynamically on NextJs Document?

I have a multi language site and need to set up the HTML lang attribute according the language for the each page. I try to pass the value in context, but does not update when page changes. Here the ...
MiguelSlv's user avatar
  • 14.7k
39 votes
1 answer
61k views

express: how to send html together with css using sendFile?

var app = require('express')(); app.get('/', function(req, res) { res.sendFile(__dirname + "/" + "index.html"); }); <link rel="stylesheet" href="style.css"> I used the above Node.js ...
neolicd's user avatar
  • 1,069
39 votes
8 answers
86k views

Why cookies and set-cookie headers can't be set while making xmlhttprequest using setRequestHeader?

I was wondering why one cannot set cookie headers using setRequestHeader. Is there any specific reason or just that they are added by browser itself, so these headers are disabled? Is there any ...
jsist's user avatar
  • 5,243
39 votes
5 answers
18k views

"Compile" CSS into HTML as inline styles

I am writing an e-mail HTML template, and some e-mail clients do not support <style> for specifying CSS. The only alternative for applying CSS is to use inline styles (style attribute). Is ...
strager's user avatar
  • 89.4k
38 votes
10 answers
195k views

Passing a variable from node.js to html

I am trying to pass a variable from node.js to my HTML file. app.get('/main', function(req, res) { var name = 'hello'; res.render(__dirname + "/views/layouts/main.html", {name:name}); });
vic-3's user avatar
  • 994
37 votes
3 answers
24k views

Can I load a local html file with the cheerio package in node.js?

I have a few html files on my harddrive that I'd like to use jquery on to extract data from. Is this possible to do using cheerio? I've tried giving cheerio the local path but it doesn't work. One ...
Jpaji Rajnish's user avatar
36 votes
5 answers
34k views

Browserify with require('fs')

I was trying to use browserify on a file that uses the fs object. When I browserify it, the call to require('fs') doesn't get transformed and require returns {}. Is there any workaround for this? I'...
Fred Finkle's user avatar
  • 1,977
36 votes
15 answers
174k views

Error: ENOENT: no such file or directory, stat '/public/main.html' at Error (native)

This is my server.js file: var express = require('express'), app = express(); app .use(express.static('./public')) .get('*',function (req,res) { res.sendfile('/public/main.html'...
pradeep murugan's user avatar
35 votes
4 answers
52k views

What will happen if sourcemap is set as false in Angular

I'm new in Angular. I saw sourcemap in tsconfig.json and by default it is "sourceMap": true. I had few doubts and found this link useful. Still I have the following doubt regarding the same. I set "...
kmg's user avatar
  • 1,285
35 votes
5 answers
19k views

Are there any module that works like django admin in Nodejs?

I am search an admin panel like django’s, why nodejs not have one? could you giveme links o a feedback of the benficts that use this kinds of admins. Is necesary by nodejs??
Dick Van Ocampo's user avatar
33 votes
2 answers
43k views

Concatenating a variable + string in Jade file

I am passing in a session variable from my mongodb session store in an Express for Node.js web app like this: exports.dashboard = function(req, res){ res.render('dashboard', {pref: req.session....
gjw80's user avatar
  • 1,068
33 votes
1 answer
95k views

How to call a server side function from client side (e.g. html button onclick) in Node.js?

I need a complete basic example in Node.js of calling a server-side function from (client side) html button onclick event, just like in ASP.NET and C#. I am new to Node.js and using the Express ...
Saad Abdullah's user avatar
32 votes
5 answers
26k views

Performant parsing of HTML pages with Node.js and XPath

I'm into some web scraping with Node.js. I'd like to use XPath as I can generate it semi-automatically with several sorts of GUI. The problem is that I cannot find a way to do this effectively. jsdom ...
polkovnikov.ph's user avatar
32 votes
11 answers
107k views

" Could not send request " error in Postman Web version

I am using postman web version. I sent request using POST on url = localhost:3000/students But it is giving error : Could not send request Cloud Agent Error: Can not send requests to localhost. Select ...
ritik jain's user avatar
31 votes
4 answers
39k views

Connecting to remote SSH server (via Node.js/html5 console)

I have been scouring the face of the web looking to answer a question which I had thought would be simple. My goal is straight forward. I want to build out a simple web-based SSH client using Node.js ...
Ethan's user avatar
  • 797
30 votes
3 answers
21k views

JavaScript EventSource SSE not firing in browser

I have been developing a nodejs server to provide server-side-events for a new website I am developing in HTML5. When I telnet to the server it works correctly, sending me the required HTTP response ...
Dan's user avatar
  • 739
30 votes
1 answer
79k views

How can I use Nodejs with Windows 7? [closed]

I'm about to became insane looking for it, most of the examples shows only how to run it on linux terminal and just the communication with the server. Can someone PLEASE explain to me how I can use ...
Demetrio's user avatar
  • 399

1
2 3 4 5
187