Skip to content

Commit

Permalink
Utilise le module path, pour constuire les chemins
Browse files Browse the repository at this point in the history
  • Loading branch information
etienneCharignon authored and cprodhomme committed Oct 29, 2021
1 parent 715b9a1 commit d5cb0cf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
var express = require('express');
var path = require('path');

var app = express();

var directory = '/' + (process.env.STATIC_DIR || 'public');
var directory = path.join('/', (process.env.STATIC_DIR || 'public'));
var router = express.Router();

router.get('/', function (req, res, next) {
res.redirect('/jeu');
});
app.use('/', router);
app.use(express.static(__dirname + directory));
app.use(express.static(path.join(__dirname, directory)));

var port = process.env.PORT || 7700;
app.listen(port, function () {
Expand Down

0 comments on commit d5cb0cf

Please sign in to comment.