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

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 :: variables in javascript 
Javascript :: javascript test throw error 
Javascript :: basic area chart 
Javascript :: setimmediate javascript 
Javascript :: npm ERR! missing script: build:dev 
Javascript :: map function javascript 
Javascript :: destructuring javascript 
Javascript :: javascript string slice 
Javascript :: axios async await 
Javascript :: what is javascript 
Javascript :: screenshot 
Javascript :: usereducer in react 
Javascript :: excel json to table 
Javascript :: react native better camera 
Javascript :: giphy javascript github 
Javascript :: js catch errors on listeners 
Javascript :: google script getactivescell 
Javascript :: get table schema with knex 
Javascript :: alert on right click jquery 
Javascript :: making all makers to show in react native map 
Javascript :: javascript popup canvas 
Javascript :: javascript select element have long word 
Javascript :: how to program in javascript and jquery on a page 
Javascript :: quagga node 
Javascript :: how to add theme attribute to :root 
Javascript :: renderer.setElementStyle 
Javascript :: cadena promesas javascript 
Javascript :: javascript play many background music 
Javascript :: f and j keys 
Javascript :: elements under p5 canvas 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =