2019-11-17 02:27:32 +00:00
|
|
|
const path = require("path");
|
2020-01-11 16:48:56 +00:00
|
|
|
const express = require("express");
|
2019-11-17 02:27:32 +00:00
|
|
|
const outDir = path.resolve("./dist/" || process.env.OUT_DIR);
|
|
|
|
const app = express();
|
|
|
|
app.use(express.static(`${outDir}`));
|
|
|
|
|
|
|
|
function runCommand(program) {
|
2020-01-11 16:48:56 +00:00
|
|
|
const port = program.port ? program.port : 3000;
|
2019-11-17 02:27:32 +00:00
|
|
|
|
2020-01-11 16:48:56 +00:00
|
|
|
app.get("/", (req, res) => {
|
|
|
|
res.sendFile("/index.html");
|
|
|
|
});
|
2019-11-17 02:27:32 +00:00
|
|
|
|
2020-01-11 16:48:56 +00:00
|
|
|
app.listen(port);
|
|
|
|
console.log(
|
|
|
|
`\nGitfolio running on port ${port}, Navigate to http://localhost:${port} in your browser\n`
|
|
|
|
);
|
2019-11-17 02:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2020-01-11 16:48:56 +00:00
|
|
|
runCommand
|
2019-11-17 02:27:32 +00:00
|
|
|
};
|