Skip to content

Instantly share code, notes, and snippets.

View mbIkola's full-sized avatar
🦍
return code || die;

Nickolay Kharchevin mbIkola

🦍
return code || die;
View GitHub Profile
@mbIkola
mbIkola / express_subrouters_list_all.js
Created February 21, 2023 20:57 — forked from creisle/express_subrouters_list_all.js
List all routes registered on an express router with sub-routers
/**
* This is a HACK to fetch all routes from an express
* router with nested sub-routers
*
* It uses the regex pattern added to the sub-router and
* tries to normalize it into something more human readable
* since this doesn't appear to be stored elsewhere as far
* as I could tell
*/
const replaceParams = (string) => {

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.