HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/node_modules/vue-color/localServer.js
const express = require('express')
const path = require('path')
/* eslint-disable new-cap */
const app = new express()
/* eslint-enable new-cap */
const config = require('./config')

const port = process.env.PORT || 3000

app.use(express.static('client'))

/**
 * Note: Generally we don't need an application server for serving
 * static files; instead we can use a web server such as nginx for static resources.
 */
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*')
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')

  next()
})

app.get('/static/*', (req, res) => {
  res.sendFile(path.join(config.build.assetsRoot, req.path))
})

app.get('*', (req, res) => {
  res.sendFile(config.build.index)
})

app.listen(port, () => {
  console.log(`local server listening on port ${port}`)
})