Created
December 2, 2020 15:45
-
-
Save mp5maker/cbe67e196f8050aa8bc0ed364d322fe2 to your computer and use it in GitHub Desktop.
Simple Node Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
const path = require("path"); | |
const PORT = 4000 || process.env.NODE_ENV; | |
app.use(express.static(path.join(__dirname, "static"))); | |
app.use("/", (_request, response) => { | |
return response.sendFile(path.join(__dirname, "index.html")); | |
}); | |
app.listen(PORT, () => console.log(`Connected to Port: ${PORT}`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment