constants file
This commit is contained in:
parent
7d9ea4e1e6
commit
ae8f9ec6a1
2 changed files with 18 additions and 6 deletions
|
|
@ -1,17 +1,15 @@
|
||||||
|
const CONSTANTS = require("./constants");
|
||||||
|
|
||||||
const buildApp = () => {
|
const buildApp = () => {
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
const app = express();
|
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.json());
|
||||||
app.use(express.static(STATIC_DIR_PATH));
|
app.use(express.static(CONSTANTS.PATHS.STATIC_DIR_PATH));
|
||||||
|
|
||||||
app.get("/", (request, response) => {
|
app.get("/", (request, response) => {
|
||||||
response.sendFile(INDEX_PATH);
|
response.sendFile(CONSTANTS.PATHS.INDEX_PATH);
|
||||||
});
|
});
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|
|
||||||
14
src/back/constants.js
Normal file
14
src/back/constants.js
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const CONSTANTS = {};
|
||||||
|
|
||||||
|
CONSTANTS.PATHS = {};
|
||||||
|
CONSTANTS.PATHS.STATIC_DIR_PATH = path.join(__dirname, "../", "../", "dist");
|
||||||
|
CONSTANTS.PATHS.INDEX_PATH = path.join(
|
||||||
|
CONSTANTS.PATHS.STATIC_DIR_PATH,
|
||||||
|
"src",
|
||||||
|
"front",
|
||||||
|
"index.html"
|
||||||
|
);
|
||||||
|
|
||||||
|
module.exports = CONSTANTS;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue