-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): Expose API router #698
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delucis
reviewed
May 16, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @c-w! I have one small query, but in general this looks like a great idea.
Instead of passing a lobbyConfig object which may contain a uuid method and potentially also a generateCredentials method, this moves those props to the top-level options, simplifying some specificity chains.
This reverts commit f925bb4.
delucis
approved these changes
May 17, 2020
Merged
nicolodavis
added a commit
that referenced
this pull request
Sep 1, 2020
* feat(server): Expose API router (#698) BREAKING CHANGES: Previously a custom `uuid` function used by the Lobby API to generate game IDs could be passed in the `lobbyConfig` option on `server.run`. This must now be passed directly to the server: ```js const server = Server({ uuid: () => 'id', }); ``` ### All commits * Expose API router * refactor(server): Pass uuid directly to Server and createRouter * docs(server): Move uuid from lobbyConfig on run to Server options Co-authored-by: delucis <swithinbank@gmail.com> * fix(api): Expose gameover metadata in rooms endpoints. (#666) * fix(api): Expose gameover metadata in rooms endpoints. This adds the `gameover` metadata, if it exists, to both the all rooms and single room query endpoints. Fixes #665. * Refactor game metadata redacting into a function. Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * refactor(server): Use the term "match" in the API and Lobby (#704) Closes #703 * GameMetadata -> MatchMetadata * rooms -> matches * API exposes `matchID`, make Lobby use that instead of `gameID` or `roomID`. * CreateGame -> CreateMatch * gameID, roomID -> matchID * Document Lobby API endpoints. * nextRoomID -> nextMatchID * Update error messages. * gameList -> matchList * Use "match" wherever it makes sense in lobby code. * Replace "room" with "match" in documentation. * Rename 'game' to 'match' in comments and test names. Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * doesGameRequireAuthentication -> doesMatchRequireAuthentication * Rename gameID to matchID in database interface functions. Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * Merge branch 'master' into 0.40.0 * feat(server): allow to filter listGames query (#740) * add createdAt, updatedAt to metadata, add listGames filters * case-insensitive boolean parsing * implement inmemory listGames filter * feat: Add plain JS lobby client (#728) * feat(server): Create types for Lobby API data Closes #707 This creates types for data returned by the Lobby API and uses them to type the response bodies in the server-side router. * refactor(types): Include min and max players options in Game interface * refactor(lobby): Convert connection class to Typescript * feat(lobby): Create a plain JS LobbyClient LobbyClient is a lightweight wrapper around `fetch` calls to a boardgame.io Lobby API server. Apart from the server’s base URL, it is stateless and serves mainly to allow argument validation and to abstract away a few request details. Unlike plain fetch, requests will throw errors if they don’t return `ok` (i.e. status 2xx). * refactor(lobby): Use new LobbyClient class in React lobby connection * fix(lobby): Include missing import for React types * docs(api): Update Lobby docs to convert game to match more thoroughly * docs: Correct inline documentation block * docs: Update Lobby docs - Add examples with the plain JS client - Move the server config details to the Server doc * feat(lobby): Add support for listMatches filtering to client #740 added the ability to pass query string parameters to the listMatches API endpoint to filter the matches returned. This adds support for building the relevant query string to the lobby client’s listMatches method. * test(lobby): Fix type error in Lobby connection test Add `createdAt` and `updatedAt` fields to mock match data * test(db): Fix coverage for InMemory storage class * test(master): Fix muddled updatedAt/gameover tests Two tests for gameover & updatedAt in match metadata were mislabelled/mixed up a bit. This tidies up the confusion and in the process improves test coverage. * test(api): Add coverage for invalid query params when listing matches * feat: Improve consistency around “match” instead of “game” (#765) * refactor: Rename `gameID` to `matchID` in clients & transports * docs: Update to replace `gameID` with `matchID` * docs: Update example code to use `matchID` instead of `gameID` * refactor: `gameMetadata` → `matchMetadata` in clients & transports * refactor: `matchMetadata` → `matchData` * refactor(types): `MatchMetadata` → `MatchData` * fix test Co-authored-by: Clemens Wolff <clewolff@microsoft.com> Co-authored-by: Adrian Gaudebert <adrian@gaudebert.fr> Co-authored-by: janKir <9143877+janKir@users.noreply.github.com> Co-authored-by: Nicolo John Davis <nicolodavis@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors
Server.run
to separate setting up the API routes from running the API server. Splitting these responsibilities enables developers to more easily customize hosting of the app, e.g. customizing the CORS setup, mounting the API routes at a path prefix, etc.Checklist
master
).