if (req.url === "/script.js")
JavaScript
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){
throw err;
}
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(data);
res.end();
return;
});
} else if (req.url === '/script.js') {
fs.readFile('./script.js', function (err, data) {
if (err) { throw err; }
res.writeHead(200, { 'Content-Type': 'text/javascript' });
res.write(data);
res.end();
return;
});
}
}).listen(3000);
Also in JavaScript:
- Title
- how to make a factorial function in javascript
- Category
- JavaScript
- Title
- get last item in array js
- Category
- JavaScript
- Title
- angular ngclass
- Category
- JavaScript
- Title
- javascript canvas reset transform
- Category
- JavaScript
- Title
- javascript Clone an array
- Category
- JavaScript
- Title
- how to link javascript to html
- Category
- JavaScript
- Title
- canvas line color
- Category
- JavaScript
- Title
- concat object
- Category
- JavaScript
- Title
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project electronicbookshop: Compilation failure
- Category
- JavaScript
- Title
- how to make a deep copy in javascript
- Category
- JavaScript
- Title
- dotnet core ajax post of an ojject site:stackoverflow.com
- Category
- JavaScript
- Title
- how to get element from arraylist react
- Category
- JavaScript
- Title
- how to add objects in array
- Category
- JavaScript
- Title
- forever loop in js
- Category
- JavaScript
- Title
- ajax with progress bar
- Category
- JavaScript
- Title
- devexpress dxdatagrid custom text field
- Category
- JavaScript
- Title
- convert 2 lists to json python
- Category
- JavaScript
- Title
- changing columns for table requires doctrine dbal install doctrine/dbal
- Category
- JavaScript
- Title
- how to make a inventory in js
- Category
- JavaScript
- Title
- Bots server count discord js
- Category
- JavaScript
- Title
- edit onclick event
- Category
- JavaScript
- Title
- if clicked outside of div jquery
- Category
- JavaScript
- Title
- boucle for of javascript
- Category
- JavaScript
- Title
- How to get the path to the file that required your module?
- Category
- JavaScript
- Title
- console.log javascript
- Category
- JavaScript
- Title
- how to add validator to formgroup
- Category
- JavaScript
- Title
- how to build a string javascript es6
- Category
- JavaScript
- Title
- how to push values in array
- Category
- JavaScript
- Title
- how to animate array oy react elements
- Category
- JavaScript
- Title
- array length for boolean in javascript
- Category
- JavaScript
- Title
- add jquery to wordpress
- Category
- JavaScript
- Title
- deploy angular app on google app engine
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- how to start react
- Category
- JavaScript
- Title
- componentWillUnmount functional component for asynchronous requests
- Category
- JavaScript
- Title
- enzyme check state
- Category
- JavaScript
- Title
- get string of element
- Category
- JavaScript
- Title
- how to open bash_profile
- Category
- JavaScript
- Title
- get selected text js
- Category
- JavaScript
- Title
- how to play sound on load js
- Category
- JavaScript
- Title
- add a slash to string in javascript
- Category
- JavaScript
- Title
- get url of page in background script
- Category
- JavaScript
- Title
- es6 closures
- Category
- JavaScript
- Title
- bq show pretty json
- Category
- JavaScript
- Title
- how to manage a db connection in javascript
- Category
- JavaScript
- Title
- check array for duplicate values javascript
- Category
- JavaScript
- Title
- ellipsis javascript
- Category
- JavaScript
- Title
- generate bearer token
- Category
- JavaScript
- Title
- angular rebuild
- Category
- JavaScript
- Title
- ad data to js object
- Category
- JavaScript
- Title
- express js sample project
- Category
- JavaScript
- Title
- javascript are arrays equal
- Category
- JavaScript
- Title
- ISS proxy express
- Category
- JavaScript
- Title
- how to see if a web site is useing react
- Category
- JavaScript
- Title
- go to another page javascript
- Category
- JavaScript
- Title
- define a route with path paramters in nodejs
- Category
- JavaScript
- Title
- in javascript check is is an array or not
- Category
- JavaScript
- Title
- angular onchange event
- Category
- JavaScript
- Title
- add new items in a select input using js
- Category
- JavaScript
- Title
- javascript add text to textarea overwrite
- Category
- JavaScript
- Title
- adding mui theme to index.js
- Category
- JavaScript
- Title
- addEventListener
- Category
- JavaScript
- Title
- how to add multiple comment in react
- Category
- JavaScript
- Title
- bootstrap modal remove gray background
- Category
- JavaScript
- Title
- inheritance in javascript
- Category
- JavaScript
- Title
- how to import npm packages in node.js?
- Category
- JavaScript
- Title
- datatables server side
- Category
- JavaScript
- Title
- how to add prototype in javascript
- Category
- JavaScript
- Title
- get value from textbox in vanilla javascript
- Category
- JavaScript
- Title
- How do you call a functional component in React
- Category
- JavaScript
- Title
- how to fill false into array javascript
- Category
- JavaScript
- Title
- file input disable open file picker javascript
- Category
- JavaScript
- Title
- get date one week from now javascript
- Category
- JavaScript
- Title
- how accurate is pi javascript
- Category
- JavaScript
- Title
- how to Write a program that simulates a coin toss using random method of Javascript Math class
- Category
- JavaScript
- Title
- how to add up all the numbers in between 0 and that number
- Category
- JavaScript
- Title
- how to get the div value in jquery
- Category
- JavaScript
- Title
- html to jsx
- Category
- JavaScript
- Title
- .push js
- Category
- JavaScript
- Title
- devexpress dxdatagrid custom text field link
- Category
- JavaScript
- Title
- how to create seeds in sequelise
- Category
- JavaScript
- Title
- how the sort function works javascript
- Category
- JavaScript
- Title
- how to do bubble sort in javascript
- Category
- JavaScript
- Title
- clearinterval javascript
- Category
- JavaScript
- Title
- .join javascript
- Category
- JavaScript
- Title
- dataset js
- Category
- JavaScript
- Title
- beautify json python
- Category
- JavaScript
- Title
- how to write in js
- Category
- JavaScript
- Title
- buble sort in js
- Category
- JavaScript
- Title
- javascript add scroll listener
- Category
- JavaScript
- Title
- go to another page using javascript
- Category
- JavaScript
- Title
- gsap
- Category
- JavaScript
- Title
- git remote url change
- Category
- JavaScript
- Title
- box shadow javascript style change
- Category
- JavaScript
- Title
- how to use the foreach method in javascript
- Category
- JavaScript
- Title
- express and node
- Category
- JavaScript
- Title
- font awesome in react
- Category
- JavaScript
- Title
- javascript click button by id
- Category
- JavaScript
- Title
- angular run with proxy
- Category
- JavaScript
- Title
- how to get today date in javascript
- Category
- JavaScript