Skip to content

Instantly share code, notes, and snippets.

@simov
Created January 12, 2018 18:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simov/4e4bb0a1ecbb45b92e23608388e60909 to your computer and use it in GitHub Desktop.
Save simov/4e4bb0a1ecbb45b92e23608388e60909 to your computer and use it in GitHub Desktop.
Serve static files with NodeJS and Express
var express = require('express')
var serveIndex = require('serve-index')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic('/home/s'))
app.use('/', serveIndex('/home/s', {'icons': true, view: 'details'}))
app.listen(8001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment