express static
const path = require('path')
const express = require('express')
const app = express()
const port = process.env.PORT || 3000
const publicDirectoryPath = path.join(__dirname, '../public')
app.use(express.static(publicDirectoryPath))
app.listen(port, () => {
console.log(`Server is up on port ${port}!`)
})app.use(express.static(__dirname + '/public'));app.use(express.static('public'));
app.use(express.static('public'))
app.use(express.static('files'))
app.use(express.static('directoryName'))
#store the files in the directory as if you were making a website without expressapp.use(express.static('public'))
Also in JavaScript:
- nodejs function example
- javascript is single threaded
- component unmount useeffect
- upload multiple image using jquery
- javacript is checkbox checked
- nested loops js
- javascript url check
- js switch case
- onclick js
- flatlist onrefresh react native
- react native new project mac
- arduino vscode hex
- find in highest value key from an object javascript
- vuejs vscode unbound breakpoint
- uuid javascript
- com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON
- google sign in in firebase react
- how to set background colour i js inline stylel
- angular delete from array by name
- how to run javascript in terminal
- angular navigate using component
- update object in react hooks
- d3 tree dag
- prevent multiple form submissions javascript