Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express static page

const express = require('express')
const path = require('path')

const app = express()
app.use('/public', express.static(path(__dirname) + '/public'))
// the directory '/public' represents whatever direcotory your html file is
// example: if your host naturally looks for a file named 'index.html', then
//   when running this server on that host, it will look in the directory for
//   'index.html' and will automatically display it when someone goes to 
//   (yoursite).com.  It varies from host to host.
//   Otherwise, read the docs for additional options.

// http://expressjs.com/en/4x/api.html#express.static
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #express #static #page
ADD COMMENT
Topic
Name
8+5 =