[{"data":1,"prerenderedAt":279},["ShallowReactive",2],{"project-12302639":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":27,"sentiment":28,"stance_mix":29,"scored_comments":34,"aspects":35,"strip":41,"post_text":44,"what":45,"said":67,"maker_in_thread":176,"shape":187,"grid":192,"attempts":241,"same_week":242,"maker_shows":270,"maker_hidden":271,"reader_version":272,"card":273},"12302639","pagex","Simple express-like routing for front-end","title","Show HN: Simple express-like routing for front-end","https:\u002F\u002Fgithub.com\u002Ffranciscop\u002Fpagex","github.com","franciscop",1471410369,2016,58,27,649,2264,29,"notable","dev_tools","client-side router","library",[24,21,25,26],"front-end routing","express-like routing","page.js alternative","roasted",-0.383,{"positive":30,"neutral":31,"mixed":32,"critical":33},2,4,0,10,16,{"design":36,"execution":38,"idea":39},{"positive":30,"critical":37},1,{"positive":32,"critical":30},{"positive":32,"critical":40},6,[42,32,43,32,37,32,32,37,37,37,37,37,37,43,32,43,32,43,32,37,32,37,32,42,32,37,32],5,3,null,{"problem":46,"audience":44,"pricing":44,"motivation":53,"time_to_build":44,"stack":57,"openness":66,"stage":66,"team_size":66},{"value":47,"source":48,"evidence":49},"Load scripts or run code only on matching parts of a website via path-based routing","maker",[50],{"id":51,"by":11,"text":52},"12302998","I see, but I don't really like this extra functionality for pagex. I am not looking to copy express with middleware for front-end, just wanted some easy and straight way to load…",{"value":54,"source":48,"evidence":55},"Wanted a simple way to load a script when in the correct part of the website",[56],{"id":51,"by":11,"text":52},[58],{"value":59,"source":60,"evidence":61},"path-to-regexp","commenter",[62],{"id":63,"by":64,"text":65},"12303331","andypants","It uses the same path-to-regex package. Other than that I can't tell how it's similar.","unknown",{"praise":68,"objections":79,"requests":116,"questions":146,"alternatives":166},[69],{"value":70,"source":60,"evidence":71},"Ergonomic API; parameters passed to callbacks",[72,75],{"id":73,"by":11,"text":74},"12302923","It was initially a Regex-only project so it was quite different. Then I added path-to-regex and forgot to check if there was some library out there similar so now they are quite…",{"id":76,"by":77,"text":78},"12303463","JasonSage","Quick tip, instead of passing true here, having an options object improves readability. As somebody who's never seen it before, the following does the opposite of what I expect:…",[80,95,101,109],{"value":81,"source":60,"evidence":82},"Too similar to page.js",[83,87,91],{"id":84,"by":85,"text":86},"12303233","yev","Looks good, but isn't it the as existing https:\u002F\u002Fvisionmedia.github.io\u002Fpage.js\u002F ?",{"id":88,"by":89,"text":90},"12302901","lcarlson","How is this different from page.js?",{"id":92,"by":93,"text":94},"12303976","longlho","Yeah looks exactly like page.js",{"value":96,"source":60,"evidence":97},"Solves a problem client-side routers already solved",[98],{"id":99,"by":93,"text":100},"12303989","Hmm not sure what problem this was trying to solve since client side router has been a solved one for a long time. And this is not looking close to express w\u002Fo middleware, which…",{"value":102,"source":60,"evidence":103},"No middleware support, so not really express-like",[104,108],{"id":105,"by":106,"text":107},"12303215","gberger","Uh, then you and I have very different definitions of \"express-like\". When I think of express I think of middleware.",{"id":99,"by":93,"text":100},{"value":110,"source":60,"evidence":111},"Possible ReDoS from regex routes",[112],{"id":113,"by":114,"text":115},"12302882","micaksica","I'm watching a movie so I haven't looked too deeply at this, but your regexes aren't safe from ReDoS according to substack's safe-regex [1]. It might be worth finding a…",[117,131,135],{"value":118,"source":60,"evidence":119},"Middleware support",[120,124,127],{"id":121,"by":122,"text":123},"12302869","urvader","Do you plan to support middlewares?",{"id":125,"by":89,"text":126},"12302930","I think page.js supports middleware if you're looking for something to emulate. Basically chainring callbacks.",{"id":128,"by":129,"text":130},"12302981","reaktivo","A callback is middleware, you can ``` page('\u002Fsome\u002Fpath', middleware, callback); ```",{"value":132,"source":60,"evidence":133},"Options object instead of boolean negate flag",[134],{"id":76,"by":77,"text":78},{"value":136,"source":60,"evidence":137},"Nested route namespaces like express routers",[138,142],{"id":139,"by":140,"text":141},"12302967","olalonde","One powerful feature of the Express router (but missing here) is that it's just a middleware, making composition trivial, e.g.: ``` const userRouter = router() .get('\u002F',…",{"id":143,"by":144,"text":145},"12303401","kevinsimper","Why .namespace and not .use like express?",[147,155,159],{"value":148,"source":60,"evidence":149},"Why is it called express-like?",[150,154],{"id":151,"by":152,"text":153},"12303175","jspdown","I don't understand the \"express-like\" in the title. What's similar to express in your router?",{"id":105,"by":106,"text":107},{"value":156,"source":60,"evidence":157},"How is it different from page.js?",[158],{"id":88,"by":89,"text":90},{"value":160,"source":60,"evidence":161},"Can user input be a risk given client-side execution?",[162],{"id":163,"by":164,"text":165},"12325203","SwellJoe","Isn't this client-side? So, what could a malicious user DoS other than their own browser? Am I missing something?",[167,172],{"value":168,"source":60,"evidence":169},"page.js",[170,171],{"id":84,"by":85,"text":86},{"id":88,"by":89,"text":90},{"value":173,"source":60,"evidence":174},"Express router",[175],{"id":139,"by":140,"text":141},{"comments":33,"answered":43,"key":177},[178,181,184],{"id":179,"text":180},"12302990","Ah that is really cool, recently a user requested a feature[1] that is basically this but I solved it in a different way [undocumented]: ``` pagex.base = '\u002Fusers'; pagex('\u002F',…",{"id":182,"text":183},"12305514","Because it is completely unrelated to express, and even with express that is not really how it works so it'd only cause confusion",{"id":185,"text":186},"12302909","The path is preferred to the Regex, and I hope that no developer is using user input to create a route here. As specified in substack's safe-regex: > WARNING: This module merely…",{"commenters":188,"max_depth":189,"maker_replies":33,"first_comment_mins":190,"lifespan_hours":191},15,8,90,71,[193,195,197,198,199,201,203,205,207,208,210,211,212,213,215,217,218,221,222,223,225,227,228,229,230,233,238],[139,32,42,194,140,32],"project\u002Fpositive\u002Fdesign",[179,32,32,196,11,37],"maker\u002Fneutral\u002Fdesign",[143,32,43,196,144,32],[182,32,32,196,11,37],[113,37,37,200,114,32],"project\u002Fcritical\u002Fexecution",[185,37,32,202,11,37],"project\u002Fneutral\u002Fexecution",[163,37,32,204,164,32],"commenter\u002Fneutral\u002Fprivacy",[84,30,37,206,85,32],"project\u002Fcritical\u002Fidea",[92,30,37,206,93,32],[209,30,37,206,85,32],"12304540",[99,43,37,206,93,32],[151,31,37,206,152,32],[63,31,37,200,64,32],[121,42,43,214,122,32],"project\u002Fneutral\u002Fdesign",[216,42,32,196,11,37],"12302897",[125,42,43,214,89,32],[219,42,32,220,11,37],"12302943","project\u002Fcritical\u002Fdesign",[128,42,43,214,129,32],[51,42,32,196,11,37],[105,42,37,224,106,32],"maker\u002Fcritical\u002Fdesign",[226,42,32,196,11,37],"12305546",[88,40,37,206,89,32],[73,40,32,194,11,37],[76,40,42,194,77,32],[231,40,32,232,11,37],"12305644","maker\u002Fpositive\u002Fdesign",[234,235,37,236,237,32],"12304326",7,"project\u002Fcritical\u002Fnone","newname87498324",[239,235,32,240,11,37],"12305585","maker\u002Fneutral\u002Fnone",[],[243,247,252,256,261,265],{"id":244,"name":245,"points":246,"category":20},"12270762","Beaker",160,{"id":248,"name":249,"points":250,"category":251},"12298678","Chronozone",150,"productivity",{"id":253,"name":254,"points":255,"category":251},"12278566","Hacker Hall",147,{"id":257,"name":258,"points":259,"category":260},"12302932","regl-cnn",135,"ai",{"id":262,"name":263,"points":264,"category":251},"12298747","Thyme",99,{"id":266,"name":267,"points":268,"category":269},"12303498","express-status-monitor",75,"infrastructure",13,false,"v2",{"id":274,"name":5,"line":6,"ai":271,"cat":20,"year":13,"points":14,"comments":15,"rec":27,"s":275,"top":18,"kw":276,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":277,"url":9,"mix":278,"praise":70,"objection":81,"sub":21},12302639,-0.38,[24,21,25,26],"503010011111130303010105010",[30,31,32,33],1794036546773]