X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=tictactoe.js;h=a38cea0e807f02d4e1aea2448263c7a2ebdbae1e;hb=eec2fd5c7db6f39a9994fa620619ebf005d26064;hp=766c1e4ed569cf9d2efb52bae9e7d70ffc6ce6fa;hpb=20ab7f84abd07b744d0c73f0dd54879ff884e534;p=lmno-server diff --git a/tictactoe.js b/tictactoe.js index 766c1e4..a38cea0 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -1,6 +1,6 @@ const express = require("express"); -const app = express.Router(); +const router = express.Router(); class TicTacToe { constructor() { @@ -54,7 +54,7 @@ class TicTacToe { } } -app.get('/', (request, response) => { +router.get('/', (request, response) => { const game = request.game; if (! request.session.nickname) @@ -63,7 +63,7 @@ app.get('/', (request, response) => { response.render('tictactoe-game.html'); }); -app.post('/move', (request, response) => { +router.post('/move', (request, response) => { const game = request.game; const square = request.body.square; @@ -79,7 +79,7 @@ app.post('/move', (request, response) => { game.broadcast_move(square); }); -app.get('/events', (request, response) => { +router.get('/events', (request, response) => { const game = request.game; /* These headers will keep the connection open so we can stream events. */ @@ -99,6 +99,6 @@ app.get('/events', (request, response) => { }); }); -exports.app = app; +exports.router = router; exports.name = "tictactoe"; exports.Game = TicTacToe;