19 Companion server.js (11/13)

  const [, sid, action] = parts;
  if (!validSession(sid)) {
    return action === 'view' || action === 'cmd' ? send(res, 200, NOT_SET_UP) : send(res, 400, { error: 'bad session' });
  }
  const all = games();
  const gid = activeGame(sid, q('game') || q('g'));
  if (!gid) return action === 'view' || action === 'cmd' ? send(res, 200, NO_GAMES) : send(res, 404, { error: 'no games' });
  const game = all.get(gid);
‹ PreviousReader file (.txt)Next ›