Relative Content

Tag Archive for htmlnode.js

How to test a local nodejs server from another local web project

I had a nodejs server and I used web pages to test the API locally. But I’ve now separated the nodejs project and the web pages because it was too cumbersome. Typescript was having trouble running in the root (for the server) and also running in a sub directory (public for the client JS / pages). So I’ve broken up the project into two projects.

how to connect the front end with my backend page

I have created a frontend page which has got a send email section which I want to connect with the server side page which is the email page. How will I integrate the server side code with my frontend code? I’m using node js for backend.

autoresponder canot GET”http://127.0.0.1:5500/subscribe”

setup autoresponder using node-js node mailer on my website but not working as expected i get this in the browser after running it it shows this “http://127.0.0.1:5500/subscribe”and “This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 405

How do I run multiple files on node.js?

I have a school project that I am working on, and I’m planning to use Node.js to host it. The thing is, every time I try to run it, it returns nothing.
I have 4 HTML, 2 CSS, and 2 JS files in one folder, and I’m trying to host all the HTML files.

When I load localhost:3000 with the following code in node.js, nothing recieved by the webpage. Why is this?

const http = require(‘http’); const server = http.createServer((req, res) => { console.log(req.url, req.method, req.headers); //process.exit(); res.setHeader(‘Content-Type’, ‘test/html’); res.write(‘<html>’); res.write(‘<head><title>My first page</title></head>’); res.write(‘<body><h1>Hello from my Node.js Server</h1></body>’); res.write(‘</html>’); res.end(); }); server.listen(3000); Im expecting the page to say Hello form my Node.js but instead nothing is recieved html node.js New contributor Muhammad Wajeeh is a new contributor […]