Skip to content

Instantly share code, notes, and snippets.

@mp5maker
Created December 2, 2020 15:45
Show Gist options
  • Save mp5maker/cbe67e196f8050aa8bc0ed364d322fe2 to your computer and use it in GitHub Desktop.
Save mp5maker/cbe67e196f8050aa8bc0ed364d322fe2 to your computer and use it in GitHub Desktop.
Simple Node Server
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