Skip to content

Instantly share code, notes, and snippets.

View driaug's full-sized avatar
✉️
Sending Emails

Dries Augustyns driaug

✉️
Sending Emails
View GitHub Profile
import React from "react";
export async function getStaticPaths() {
const paths = [{ params: { site: "test" } }, { params: { site: "test2" } }];
return {
paths: paths,
fallback: "blocking",
};
}
import { NextResponse } from "next/server";
/**
* @param req
*/
export default function middleware(req) {
const { pathname } = req.nextUrl;
// Get hostname (e.g. vercel.com, test.vercel.app, etc.)
const hostname = req.headers.get("host");
@driaug
driaug / promises.js
Last active February 18, 2021 10:39
.then and await compared
const asyncFunction = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
return resolve("Result of async function");
}, 1000);
});
};
// .then will continue and go to the next line of code before resolved
asyncFunction().then((result) => console.log(result));

Wat zijn optionele parameters?

zie hoofdstuk 5.10 Geef een voorbeeld! Gebruik maken van parameters waarvan je geen waarde geeft

static void optioneleParameters(int x, int y) //je moet x en y niet meegeven want de standaardwaarde is 0 en daar kan mee gerekend worden.
{
int resultaat = x + y //de uitkomst zou 0 zijn als je geen waarde meegeeft
}