This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Don't use MongoDB | |
================= | |
I've kept quiet for awhile for various political reasons, but I now | |
feel a kind of social responsibility to deter people from banking | |
their business on MongoDB. | |
Our team did serious load on MongoDB on a large (10s of millions | |
of users, high profile company) userbase, expecting, from early good | |
experiences, that the long-term scalability benefits touted by 10gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stringify(data) { | |
if (data === undefined) | |
return undefined | |
if (data === null) | |
return 'null' | |
if (data.toString() === "NaN") | |
return 'null' | |
if (data === Infinity) | |
return 'null' | |
if (data.constructor === String) |
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Custom Typings for Next 13 | |
"typescript.tsdk": "node_modules/typescript/lib", | |
// For Prettier | |
"editor.formatOnSave": true, | |
"editor.defaultFormatter": "esbenp.prettier-vscode", | |
"prettier.requireConfig": true, | |
"[prisma]": { | |
"editor.defaultFormatter": "Prisma.prisma" |