Created
December 16, 2017 12:39
-
-
Save danivijay/8bc7174adb59f857f82b4e5dcacf5c7c to your computer and use it in GitHub Desktop.
Updated https://gist.github.com/danivijay/e0bb66f851f0bb3f49a797423f679070 with ES6
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
import express from 'express'; | |
import path from 'path'; | |
import open from 'open'; | |
const port = 3000; //choose different, if this port not available | |
const app = express(); | |
app.get('/',function(req, res) { | |
res.sendFile(path.join(__dirname, '../src/index.html')); | |
}); | |
app.listen(port, function(err) { | |
if (err) { | |
console.log(err); | |
} else { | |
open('http://localhost:' + port); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment