-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Fix] bodyparser example - support for Content-Type of application/x-www-form-urlencoded #1264
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
… application/x-www-form-urlencoded
jcrugzz
approved these changes
Jun 6, 2018
Thanks @renxia |
cappadona
added a commit
to cul-it/signage
that referenced
this pull request
Sep 14, 2018
All together now... * dotenv [1] * axios module [2] * proxy module [3] * serverMiddleware [4] * body-parser [5] Go team. Heavily based on modify-post example [6] from http-proxy-middleware. The need to restream the parsed body prior to proxying [7 - 9] was a special treat. [1] https://github.com/motdotla/dotenv [2] https://axios.nuxtjs.org/ [3] https://github.com/nuxt-community/proxy-module [4] https://nuxtjs.org/api/configuration-servermiddleware [5] https://github.com/expressjs/body-parser [6] https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/modify-post.md [7] chimurai/http-proxy-middleware#40 (comment) [8] http-party/node-http-proxy#1027 [9] http-party/node-http-proxy#1264
cappadona
added a commit
to cul-it/signage
that referenced
this pull request
Sep 14, 2018
* First go at study room availability for LCD Using two tiers of mocked data: * first result set is hardcoded into a mocked components * second result set is loading a mocked JSON file based on actual LibCal API response Very much a work in progress. * Iterate bookings, add available slots btw & after First pass at this. Not accounting for leading available slots since we're still working with mock data and unsure whether the API drops/excludes bookings once current time is greater than the `toDate`. Early testing indicates this is not the case (any booking with a datetime for the requested date remains), which will mean more logic needs to be introduced to handle open and current availability. * Update data mock based on LibCal test reservations * Refactor & simplify logic for room availability Leaning heavily on lodash chaining [1] to filter and map the original bookings array returned by LibCal API. Big hat tip to Pete from this SO thread [2]. [1] https://blog.mariusschulz.com/2015/05/14/implicit-function-chains-in-lodash [2] https://codereview.stackexchange.com/questions/82596/lodash-chain-implementation * Leading padding for first booking when necessary While implementing this, realized that the filter for removing past bookings needs to be moved to the end of the chain, after the logic for determining availability padding. * Enforce open/close times Can't hurt to double check. Don't assume that LibCal spaces API returns bookings that abide to current/correct hours. * Overhaul opening/closing handling * Ensure moment object is returned * Split out check for early morning closing (DRY) * Dedicated function to format time for display * Down with this keyword * Note to self: DRY variables & util styles * Drop mock study room component Served admirably... * Refactor to store space schedules in Vuex Mocked data is no longer needed, so drop it along with baggage. Only fetching data via LibCal API on initial load for now (no interval). TODO: Use dotenv to handle sensitive LibCal oAuth data * Note to self about unique bookId for avail slots * Generalize dynamic routing Allow for more flexibility to better accommodate future use cases with minimal effort. * Move _location (aka library) to first segment * Pass category as route param for spaces > For now, moving Mann signs (consultation desks and study rooms) but > leaving OKU untouched to avoid downtime. TODO: coordinate new URLs > with Olin & Uris circ at later date. * Extract LibCal schema & generalize hour functions First step in cleaning house and modularizing LibCal utils. Potential to eventually extract into separate package. Also generalize the hours related functions to use `location` in place of 'desk'. Still a bit awkward with passing of the `isDesk` param to handle different lookup in the schema, but wanted to keep the consultation desks grouped together. Most likely will revisit this down the road. * Generalize component & requested spaces as param No longer hardcoded for Mann study rooms. * Prime store with requested spaces Necessary since LibCal returns empty array if no bookings exist. * Generalize hours store for desks & spaces Still a bit of a work in progress in terms of: * logic for space open/close * assumption that all requested spaces follow same hours (applicable for the Mann reservable study room pilot) * Use location for retrieving LibCal space bookings Still a work in progress. Need to fine tune the filtering (down to requested spaces). Also started on simplifying opening/closing via hours store, but needs work. * Filter LibCal bookings to requested spaces * Keep LibCal API creds secret All together now... * dotenv [1] * axios module [2] * proxy module [3] * serverMiddleware [4] * body-parser [5] Go team. Heavily based on modify-post example [6] from http-proxy-middleware. The need to restream the parsed body prior to proxying [7 - 9] was a special treat. [1] https://github.com/motdotla/dotenv [2] https://axios.nuxtjs.org/ [3] https://github.com/nuxt-community/proxy-module [4] https://nuxtjs.org/api/configuration-servermiddleware [5] https://github.com/expressjs/body-parser [6] https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/modify-post.md [7] chimurai/http-proxy-middleware#40 (comment) [8] http-party/node-http-proxy#1027 [9] http-party/node-http-proxy#1264 * Extract restream function from proxy config Quick refactor in attempt to maintain overall clarity for Nuxt config. * Closed status with next opening time Rename existing `formatFutureOpening()` used for consultation signs to `formatStatusChange()`. * Remove jsonp-promise No longer needed now since CORS is a non issue thanks to proxying implemented in cc90db6. All axios all the time. > jsonp-promise first introduced via 41 * Sync/update for spaces sign via setInterval * time every 10s * hours every 30s * reservations every 1m * Fix lodash import for libcal util Doh...cherry-picking on the import was not intended here. Was causing trouble when fetching reservations from the client via setInterval. Specifically when attempting to build the schedule using, encountering `undefined` errors for the lodash methods. * Available til closing for spaces with no schedule * Reservation URL in the footer #72 * FA icons to indicate indiv vs group rooms Quick-n-dirty for now with Font Awesome 5.2 via CDN. WIll revisit to: * Use packages & official Vue.js components * Clean up logic for determining which icon applies for each space * Account for early AM closings within nextOpen() Doh. Never encountered this with the consultation desks but today with the Fall semester in full swing, moment's isBetween() was always returning false for reservable study spaces. Probably should consider refactoring the closingTime() method to pass hours as optional argument instead of always fetching them from the LibCal API. This would allow further DRYing. * Https for reserve link * Quick-n-dirty font scaling for launch Go time...will be revisited. * Drop lightweight font As per feedback from working group. Chromebox is having difficulty rendering lightweight Lato. Keeping it for meridiem on block start time since it appears to be legible on the photos sent by the group. * Bump limit on LibCal bookings API to 100 (max) Default is 20. Noticed that a reservation for 270 was dropped from the sign during the day. While bumping to the max provides us some leeway, we will have to keep our eye on this and see if we still hit the ceiling during peak semester activity. * Display 12am as midnight * Reserve link to top, consistent wght for datetime And more breathing room for header. Go team! * Sort each space's reservation by start time Not sure if something changed in LibCal's API response, but this hadn't been necessary until noticing the issue today. * Unique ID for available time slots Via unique-string package. * Improve test for empty schedule There are occasions when the object exists but the schedule array is empty due to the fact that the API returns all bookings (even canceled by either party) and only those bookings with a `confirmed` status remain after filtering. * Remove debugging holdouts & rename bookingsParser
This was referenced Sep 5, 2020
This was referenced Sep 8, 2020
This was referenced Sep 9, 2020
This was referenced Sep 9, 2020
This was referenced Mar 17, 2021
Merged
This was referenced Sep 12, 2024
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.
Restream body before proxying, fix to support for Content-Type of application/x-www-form-urlencoded.
#955 #843 #1027