1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00
gitfolio/run.js

28 lines
672 B
JavaScript
Raw Normal View History

const express = require('express');
const open = require('open');
const defaultBrowser = require('x-default-browser');
2019-05-26 10:01:16 +00:00
const path = require('path');
2019-05-24 07:24:26 +00:00
const outDir = path.resolve('./dist/' || process.env.OUT_DIR);
const app = express();
2019-05-26 10:01:16 +00:00
app.use(express.static(`${outDir}`));
function runCommand(){
app.get('/',function(req,res){
res.sendFile('/index.html');
});
2019-05-26 10:01:16 +00:00
app.listen(3000);
2019-05-26 10:01:16 +00:00
defaultBrowser(function (err, res) {
if(err) throw err;
(async () => {
await open('http://localhost:3000', {app: res.commonName});
console.log("ctrl + c to exit");
})();
});
}
module.exports = {
runCommand
2019-05-26 10:01:16 +00:00
};