Answers for "serve build node npm"

0

serve build node npm

# in terminal cd to project root dir
# to build project:
npm run build
# to serve/host project locally:
serve -s ./build
Posted by: Guest on January-08-2021
0

create express server local

// create directory

//npm init -y
//npm i express --save

//create public directory
//create server.js

// <---- In the server js file --->

'use strict';

const express = require('express');
const app = express();
app.use(express.static('public'));// to connect with frontend html
app.use(express.json());//body parse

app.get('/', function(req,res){
	res.send('This is the Homepage');
  	//res.sendFile('index.html');
});

app.listen(3000);
Posted by: Guest on January-07-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language