MongoDB Crash Course 2022 < TODO: Add Video Link
An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.
The way we recommend handling redirects has changed in React Router v6. This document explains why.
In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:
This is a not great piece of code I've wrote few years ago (I didn't have better things to do when I was 17, apperantly),
when I was fiddling around with the V8 JS Engine. It doesn't work with newer versions of V8, since the library doesn't have a
stable API. Time, where I had time to fight with the depot_tools and lackluster MSVC support for fun is long gone.
I've tried to redo this example once in the past, after I've got an email notification that someone got interested in stuff
that I've put on the net and have forgotten about. Toolset got even more picky than I remember it being and my attention
for personal programming projects drifted away somewhere else, so it's highly unlikely that I'll update it to the newer API.
But I'm leaving the code there, maybe someone will make good use of it.
NOTE: If you have Windows 11 there is now an official way to do this in WSL 2, use it if possible - see MS post here (WINDOWS 11 ONLY)
This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.
-
To enable
systemdunder WSL we require a tool calledsystemd-genie -
Copy the contents of
install-sg.shto a new file/tmp/install-sg.sh:
Starting a personal node project could be easy; starting a team node project could be challenging.
I am a developer currently working in SEEK Australia.
In my experience, common mistakes developer make when starting a projects are:
- No Linting
| const Rx = require( 'rxjs/Rx' ); | |
| // This took me way too long to figure out. Hope this helps someone. | |
| // <3 Well Caffeinated | |
| function fromCursor( cursor ){ | |
| return new Rx.Observable((obs) => { | |
| // is the connection closed | |
| var closed = false | |
| // get the next document |
Make a configuration file like below at /etc/systemd/system/nodejs_www.service.
[Unit]
Description=My Node.js Web Server
[Service]
ExecStart=/usr/bin/yarn start
WorkingDirectory=/home/hotohoto/app
| // Get all users | |
| var url = "http://localhost:8080/api/v1/users"; | |
| var xhr = new XMLHttpRequest() | |
| xhr.open('GET', url, true) | |
| xhr.onload = function () { | |
| var users = JSON.parse(xhr.responseText); | |
| if (xhr.readyState == 4 && xhr.status == "200") { | |
| console.table(users); | |
| } else { | |
| console.error(users); |
