run node app locally
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))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, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});// Run this command in your terminal to start your node application.
// Replace the tag with your applications main file name (ex index.js, main.js etc).
// Add alternative a relative or absolute path before the name.
node <filename>.js
Also in JavaScript:
- max value in array javascript
- js windowresize event
- setup node and mongodb on centos 7 using npm
- how to push values in array
- rounding to nearest hundredth js
- js hide div
- get ip of user in node js
- how to empty table after closing modal using jquery
- Use multiple conditional operators in the checkSign function to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".
- round to decimal javascript
- javascript dom elements
- recursive function in js
- email validation regex
- js array join
- find duplicate values in array javascript
- how to make an async function
- js window resize listener
- Angular 4 execute function from another component
- draw point p5js
- Set Custom User Agent react
- javascript regex reference
- range javascript
- difference between ajax and node js
- js combine two arrays