Skip to content

Instantly share code, notes, and snippets.

Last active August 30, 2017 02:27
What would you like to do?
NodeJS > create a quick web server and serve files

Init your folder

npm init

Create your index.js

var express = require('express'),
app = express(),
port = process.env.PORT || 8080;

app.use(express.static(__dirname + '/public'));

Put all your static file in the ./public folder

mkdir public
mv myFiles ./public

Start your server

node index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment