Skip to content

Instantly share code, notes, and snippets.

@sallos-cyber
Created March 20, 2022 14:40
Show Gist options
  • Save sallos-cyber/1c6ff5c559701a75bdacfecbc7ea3495 to your computer and use it in GitHub Desktop.
Save sallos-cyber/1c6ff5c559701a75bdacfecbc7ea3495 to your computer and use it in GitHub Desktop.
to use node.js as http server
const express = require('express')
const path = require('path')
const httpPort = 1026
const app = express()
app.use(express.static(path.join(__dirname, './')))
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname, './index.html'))
})
app.listen(httpPort, function () {
console.log(`Listening on port ${httpPort}!`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment