From 031f78ce27ee6155b5e24cd4342c45b8a560d9d4 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 30 Aug 2020 14:51:05 +0200 Subject: [PATCH] refactor: static path --- package.json | 4 ++-- src/app.ts | 6 +++--- views/base.twig | 10 +++++----- views/countdown.twig | 4 ++-- views/error.twig | 2 +- views/home-metas.twig | 6 +++--- views/home.twig | 4 ++-- views/organization.twig | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 4f3a6c9..e18e2b2 100644 --- a/package.json +++ b/package.json @@ -53,10 +53,10 @@ "test": "jest --verbose --detectOpenHandles", "test-watch": "jest --verbose --watchAll", "dev": "./node_modules/.bin/tsc --watch", - "serve": "env ASSETS_PATH=./assets/development ./node_modules/.bin/nodemon dist/app.js", + "serve": "env NODE_ENV=development ./node_modules/.bin/nodemon dist/app.js", "build": "./node_modules/.bin/tsc", "assets": "./node_modules/.bin/gulp build", - "start": "env ASSETS_PATH=./assets/production node ./dist/app.js" + "start": "env NODE_ENV=production node ./dist/app.js" }, "main": "dist/index.js", "devDependencies": { diff --git a/src/app.ts b/src/app.ts index 379f10e..93c8ad5 100644 --- a/src/app.ts +++ b/src/app.ts @@ -125,9 +125,9 @@ let main = async () => { //app.post('/api/media', MediaController.uploadRoute()) //app.delete('/api/media/:key', MediaController.delete) - const assetsPath: string = process.env.ASSETS_PATH === undefined ? './assets/development' : process.env.ASSETS_PATH - - app.use(express.static(path.resolve(assetsPath))) + //const assetsPath: string = process.env.ASSETS_PATH === undefined ? './assets/development' : process.env.ASSETS_PATH + + app.use('/static', express.static(path.resolve('./assets/development'))) app.get('/500', ErrorController.internalError) diff --git a/views/base.twig b/views/base.twig index 41ced59..8e2bfe7 100644 --- a/views/base.twig +++ b/views/base.twig @@ -8,14 +8,14 @@ Github: https://github.com/lefuturiste - + {% block title %}{% endblock %} | Forum des associations 2020 - + {% if layout is not defined %} - + {% endif %} {% block head %}{% endblock %} @@ -29,7 +29,7 @@ Github: https://github.com/lefuturiste
- +
{% block scripts %}{% endblock %} - + \ No newline at end of file diff --git a/views/countdown.twig b/views/countdown.twig index e1983f7..5454b6e 100644 --- a/views/countdown.twig +++ b/views/countdown.twig @@ -2,7 +2,7 @@ {% block title %}Accueil{% endblock %} {% block head %} {% include './home-metas.twig' %} - + {% endblock %} {% block content %}
@@ -37,5 +37,5 @@ - + {% endblock %} diff --git a/views/error.twig b/views/error.twig index 6e61b9a..501a518 100644 --- a/views/error.twig +++ b/views/error.twig @@ -1,7 +1,7 @@ {% extends "./base.twig" %} {% block title %}{{ title }}{% endblock %} {% block head %} - + {% endblock %} {% block content %}
diff --git a/views/home-metas.twig b/views/home-metas.twig index 3eab35d..4c256cb 100644 --- a/views/home-metas.twig +++ b/views/home-metas.twig @@ -1,7 +1,7 @@ {% set metaDescription = "Découvrez la riche vie associative autour de Gaillon-Aubevoye grâce au forum virtuel mis en place par l'Espace Condorcet" %} - + @@ -13,11 +13,11 @@ - + - + diff --git a/views/home.twig b/views/home.twig index 6bf1216..fa16c01 100644 --- a/views/home.twig +++ b/views/home.twig @@ -2,7 +2,7 @@ {% block title %}Accueil{% endblock %} {% block head %} {% include './home-metas.twig' %} - + {% endblock %} {% block content %}