Skip to content

Instantly share code, notes, and snippets.

@Chadtech
Created April 13, 2016 01:39
Show Gist options
  • Select an option

  • Save Chadtech/fa1cea3c7a8958fbef640e558b8d32ad to your computer and use it in GitHub Desktop.

Select an option

Save Chadtech/fa1cea3c7a8958fbef640e558b8d32ad to your computer and use it in GitHub Desktop.
fs = require 'fs'
express = require 'express'
app = express()
http = require 'http'
{join} = require 'path'
bodyParser = require 'body-parser'
app.use bodyParser.json()
PORT = Number process.env.PORT or 2998
app.use express.static join __dirname, '/public'
app.get '/', (req, res, next) ->
indexPage = join __dirname, 'public/index.html'
res.status 200
.sendFile indexPage
httpServer = http.createServer app
httpServer.listen PORT, ->
console.log 'SERVER RUNNING ON ' + PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment