nextjs-koa-styledcomponents
nextjs-koa-styledcomponents copied to clipboard
:iphone: This is a template for creating next.js projects using KoaJs and offline features
:fire: Next.js, Koa, PWA, Styled Components Template
Do the following and you are good to go:
# be a cool kid and install with yarn
yarn
# playing around?
yarn dev
# wanna build and start? I got you.
yarn go
This project uses next-offline for the service worker stuff to cache assets. Styled-components are setup out of the box, otherwise just delete the .babelrc and anything you see related to it.
Also, this shows usage with the apimaze API, specifically for getting Batman info. Notice links in index.js are prefetched for offline usage :sparkles:
# healthcheck route added for those who need it for prod systems.
# GET
BASE_URL/healthcheck
Common issues I had
- The order of the Koa scripts is important when serving static files.
- If you're using the server.js file for serving your site running
next startwill ignore that - this took me a while to figure out. - If you want to use nextjs to add APIs, make sure that your Koa
ctx.respond = trueotherwise you won't get a response.