diff --git a/package.json b/package.json index 6f427a7..5cdd0e4 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "express": "^4.16.4", "helmet": "^3.15.0", "mysql": "^2.16.0", + "pug": "^2.0.3", "socket.io": "^2.2.0", "socket.io-client": "^2.2.0" } diff --git a/public_html/game.html b/public_html/game.html deleted file mode 100644 index b9dccfe..0000000 --- a/public_html/game.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - Crafty Things - - - - diff --git a/server.coffee b/server.coffee index 5896d84..c9a871f 100644 --- a/server.coffee +++ b/server.coffee @@ -22,6 +22,11 @@ app.use helmet() # Static content app.use express.static path.resolve(__dirname, 'public_html') +# Templates +app.set 'view engine', 'pug' +app.get '/:template.html', (req, res) -> + res.render (req.params.template + '.pug') + con = mysql.createConnection host: 'tcgsql' user: 'fftcg' diff --git a/src/pug/game.pug b/src/pug/game.pug deleted file mode 100644 index 35eacb8..0000000 --- a/src/pug/game.pug +++ /dev/null @@ -1,9 +0,0 @@ -doctype html -html - head - title Crafty Things - link(rel='stylesheet', href='style.css') - script(src='/socket.io/socket.io.js') - script(src='lib.min.js') - script(src='game.min.js') - body diff --git a/views/game.pug b/views/game.pug new file mode 100644 index 0000000..6763d6e --- /dev/null +++ b/views/game.pug @@ -0,0 +1,6 @@ +doctype html +html + head + title Crafty Things + script(src='/game.bundle.js') + body diff --git a/src/pug/index.pug b/views/index.pug similarity index 79% rename from src/pug/index.pug rename to views/index.pug index ae69c9d..f6c5528 100644 --- a/src/pug/index.pug +++ b/views/index.pug @@ -2,10 +2,7 @@ doctype html html head title Crafty Things - link(rel='stylesheet', href='style.css') - script(src='/socket.io/socket.io.js') - script(src='lib.min.js') - script(src='index.min.js') + script(src='/index.bundle.js') body h1 Hello World! h2 App under development, please don't send valuable data!