build app
This commit is contained in:
parent
a9e8fffd62
commit
7d9ea4e1e6
2 changed files with 22 additions and 13 deletions
20
src/back/buildApp.js
Normal file
20
src/back/buildApp.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
const buildApp = () => {
|
||||||
|
const express = require("express");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
const STATIC_DIR_PATH = path.join(__dirname, "../", "../", "dist");
|
||||||
|
const INDEX_PATH = path.join(STATIC_DIR_PATH, "src", "front", "index.html");
|
||||||
|
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.static(STATIC_DIR_PATH));
|
||||||
|
|
||||||
|
app.get("/", (request, response) => {
|
||||||
|
response.sendFile(INDEX_PATH);
|
||||||
|
});
|
||||||
|
|
||||||
|
return app;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = buildApp;
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
const express = require("express");
|
const buildApp = require("./buildApp");
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
const app = express();
|
const app = buildApp();
|
||||||
|
|
||||||
const STATIC_DIR_PATH = path.join(__dirname, "../", "../", "dist", );
|
|
||||||
const INDEX_PATH = path.join(STATIC_DIR_PATH, "src", "front", "index.html");
|
|
||||||
|
|
||||||
app.use(express.json());
|
|
||||||
app.use(express.static(STATIC_DIR_PATH));
|
|
||||||
|
|
||||||
app.get("/", (request, response) => {
|
|
||||||
response.sendFile(INDEX_PATH);
|
|
||||||
});
|
|
||||||
|
|
||||||
const PORT = 3003;
|
const PORT = 3003;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue