Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node js starting template

/*
Terminal Commands:
npm init
npm install express
*/

//index.js commands:
const express= require('express');
const app= express();

app.use(express.static(__dirname));     //server css file as static otherwise css won't be seen in index.html when sent through sendFile()

//handling get request for home route
app.get("/",function(req,res){     
  res.sendFile(__dirname+"index.html");
});

//handling post request for home route
app.post("/",function(req,res){
	res.send("Post request Recieved!");
});

//makes the server to reserve port 3000 for this application
app.listen("3000",function(){
	console.log("Server running on port 3000");
});
                   

Comment

Node Js templates

$ npm i vue vuex vue-loader css-loader vue-template-compiler node-sass sass-loader postcss-loader postcss-loader webpack-node-externals webpack-merge webpack babel-core babel-loader babel-plugin-transform-object-rest-spread babel-preset-env --save
Comment

PREVIOUS NEXT
Code Example
Javascript :: onclick inline function react 
Javascript :: add css on click javascript 
Javascript :: string to jsonobject gson 
Javascript :: javascript absolute path 
Javascript :: javascript string starts with 
Javascript :: react-lottie yarn 
Javascript :: jquery remove option from select 
Javascript :: how to link a photo in expo react native 
Javascript :: Angular version chrome console 
Javascript :: js convert to fraction 
Javascript :: javascript format float 
Javascript :: swal change confirm button class 
Javascript :: object to array javascript 
Javascript :: javascript sum array values 
Javascript :: js remove the last character from a string 
Javascript :: set data-id javascript 
Javascript :: jquery ajax get response code 
Javascript :: javascript js isNumber 
Javascript :: JavaScript function that generates all combinations of a string. 
Javascript :: foreach loop in react 
Javascript :: javascript detect if object is date 
Javascript :: how to change user password firebase 
Javascript :: sublime format json 
Javascript :: nodejs await inside map 
Javascript :: set image size phaser 
Javascript :: javascript take last n elements of array 
Javascript :: javascript includes 
Javascript :: classname did not match server next js styled components 
Javascript :: sortby vue 
Javascript :: add params to url vue 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =