What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-16 06:16:24
host angular app on node server
const express = require('express'); const http = require('http'); const path = require('path'); const app = express(); const port = process.env.PORT || 3001; app.use(express.static(__dirname + '/dist/my-app-name')); app.get('/*', (req, res) => res.... Add solution -
Javascript 2021-11-03 19:59:15
create node js server
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, ... Add solution -
Javascript 2021-10-30 07:29:10
nodejs websocket tutorial
/* Author: Logan Smith - Perkins */ // Importing the http library, used to start servers const http = require('http'); // Importing the websocket library which is used to interface between webpage and nodejs const WebSocketServer = require('websocket').s... Add solution -
Javascript 2021-10-26 14:16:12
if (req.url === "/script.js")
var http = require('http'); var url = require('url'); var fs = require('fs'); var path = require('path'); http.createServer(function(req, res) { if (req.url === '/') { fs.readFile('./index.html', function(err, data) { if (err){ ... Add solution -
Javascript 2021-10-12 13:28:02
read html file node js
const http = require("http"); //use fs module at first to read file const fs = require("fs"); const hostname = "127.0.0.1"; const port = 3000; // simple code to read file using fs module const files = fs.readFileSync("... Add solution -
Javascript 2021-10-08 13:18:12
implementing node js app on server and runing npm
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, ... Add solution