00:05:16  <mezod>danneu: hmm
00:05:50  <mezod>i'm using koa for an api and I am realizing I need to do a lot of queries to the database to check if a user owns a resource, so that it can make an action
00:06:02  <mezod>do you know if this is the normal way to go?
00:06:07  <mezod>this was poorly explained...
00:11:04  <danneu>mezod: sounds about right. do you have an example?
00:11:17  <TBotV63>mezod, Like... how many queries? One or two are normal. If you see that the queries are slowing your application down, try applying caching.
00:11:50  <mezod>well, one extra query for each request
00:12:50  <danneu>mezod: when possible, try to bake it into the actual query so you can do one round trip. for example, instead of seeing if user owns widget before updating widgets where widget_id = 42, instead write your update query to update widgets where widget.id = $1 AND widget.user_id = $2
00:14:02  <mezod>hmm yeah I kind of want to do that but dont have necessary info
00:14:07  <mezod>let's say
00:14:37  <mezod>hmm
00:16:24  <danneu>round trips aren't inherently bad. in fact, avoiding round trips is one of the main sources of complexity.
00:17:48  <mezod>it just feels dumb, I mean, i have an object with user_id and list_id, can't bookshelf/mysql see that the user_id doesn't match when saving instead of updating the user_id :D
00:18:01  <mezod>there should be something like static value, that can't change :P
00:19:36  <danneu>it's standard to have middleware that loads `this.currentUser` from a session_id before all your routes (roundtrip1), then load `resource` in GET '/resources/:id' (roundtrip2), assert that resource.user_id===this.currentUser.id, and then do whatever it is that the route does (roundtrip3)
00:20:06  <danneu>no big deal
00:21:30  <mezod>well, i don't think anyone could explain it better
00:21:55  <mezod>danneu: thanks :p
01:21:48  * niftylettucequit (Quit: Connection closed for inactivity)
02:56:51  * niftylettucejoined
03:31:29  * mezodquit (Remote host closed the connection)
04:38:47  * joshonthewebjoined
05:22:52  * derekjoined
05:23:15  * derekchanged nick to Guest84950
05:23:17  <Guest84950>how would one create a global property in koa 2.0?
05:57:18  * Guest84950quit (Ping timeout: 246 seconds)
07:08:27  * renklafjoined
08:31:48  * niftylettucequit (Quit: Connection closed for inactivity)
10:11:38  * joshonth_joined
10:12:19  * joshonthewebquit (Ping timeout: 244 seconds)
10:26:25  * xangoxquit (Read error: Connection reset by peer)
10:41:06  * renklafquit (Remote host closed the connection)
10:48:34  * TheThingjoined
10:56:49  * TheThingquit (Remote host closed the connection)
10:59:26  * renklafjoined
11:02:26  * deamjoined
11:04:52  * renklafquit (Remote host closed the connection)
11:11:42  * angojoined
11:36:45  * renklafjoined
12:02:48  * renklafquit (Remote host closed the connection)
12:08:40  * joshonth_quit (Quit: Computer has gone to sleep.)
12:11:11  * renklafjoined
12:25:40  * renklafquit (Remote host closed the connection)
12:35:02  * renklafjoined
12:39:37  * renklafquit (Remote host closed the connection)
12:43:52  * renklafjoined
13:06:18  * mezodjoined
13:26:25  * TheThingjoined
13:35:55  * qbmaniacjoined
13:36:19  <qbmaniac>Hi all!
13:36:42  <qbmaniac>I have a quick question but not sure if to post it in #nodejs or here...
13:37:19  <qbmaniac>If I use package A... and package A requires package B... and I fork package B and make a change that I need in package A... is it possible to force package A to use my updated version from github instead of npm?
13:37:25  <qbmaniac>Or do I also need to fork package A?
14:01:58  * renklaf_joined
14:05:39  * renklafquit (Ping timeout: 260 seconds)
14:06:34  * renklaf_quit (Ping timeout: 260 seconds)
15:02:39  * deamquit (Quit: Connection closed for inactivity)
16:04:08  * qbmaniacquit (Quit: Hasta luego)
16:28:55  * solenoidsquit (Ping timeout: 260 seconds)
16:32:43  * TheThingquit (Remote host closed the connection)
16:42:08  * solenoidsjoined
18:09:22  * renklafjoined
18:18:33  * renklafquit (Remote host closed the connection)
18:19:57  * renklafjoined
18:34:11  * mezodquit (Remote host closed the connection)
19:02:07  * renklafquit (Remote host closed the connection)
19:05:19  * renklafjoined
19:08:17  * mezodjoined
19:13:27  * mezodquit (Ping timeout: 255 seconds)
19:52:31  * felixjetquit (Read error: Connection reset by peer)
19:55:39  * joshonthewebjoined
19:59:54  * felixjetjoined
20:08:55  * joshonthewebquit (Quit: Computer has gone to sleep.)
20:21:26  * solenoidsquit (Ping timeout: 240 seconds)
20:38:45  * solenoidsjoined
21:13:47  * joshonthewebjoined
21:19:55  * renklafquit (Remote host closed the connection)
22:13:51  * delaneyjoined
22:14:14  <delaney>hi, I was looking for some help with cors in koa
22:14:37  <delaney>I think I'm setting everything up properly but running into some issues
22:17:14  <delaney>I'm doing oauth2 stuff in koa, all works well if i hit it directly in the browser but if I use superagent from within the page's javascript `Origin is not allowed by Access-Control-Allow-Origin`
22:20:12  <danneu>i know next to nothing about cors (i have to spend a day reading about it every time i touch it and then forget the next week) but i thought cors only kicked in for requests from other domains
22:20:26  * renklafjoined
22:26:02  * renklafquit (Ping timeout: 260 seconds)
23:16:19  * joshonthewebquit (Quit: Computer has gone to sleep.)
23:21:00  * joshonthewebjoined
23:25:13  * mezodjoined
23:54:19  * joshonthewebquit (Quit: Computer has gone to sleep.)