Next.js Demo Website

Next.js Demo Website

(This is a sample website - you’ll be building a site like this on our Next.js tutorial.)

This website also has examples of the four most common rendering strageties that Next.js offers when working with an external API:

Blog

Older Example Pages

Posts
First Post

API Routes

/api/hello
Description: Will always return json with the text hello.

/api/time/*
Description: Will current time. Meant to test if Cloudflare or Vercel is caching the API routes.

/api/headers
Description: Will output headers that were recieved from the server. Meant to see what headers Cloudflare and Vercel append.

/api/cache/johndoe
Description: The example on the vercel website for caching serverless functions. Caches the response and serves it fresh every 50 seconds.

/api/cache/v-stale
Description: A simple example returning the number of minutes past the hour and the number of seconds past the minute. The cache is fresh for 0-10 seconds; stale for 10-59 seconds, but served from the cache, and in the background is revalidated; completely stale after 60 seconds and must be fetched from the server.

Math Routes

These are just joke routes meant to test how vercel handles more than 12 API functions

/api/math/isEven/:number
Description: Returns if an integer is Even.

/api/math/isOdd/:number
Description: Returns if an integer is Odd.

/api/math/randyRandom
Description: Returns a random number. The number is cached in the Vercel CDN for 10 minutes.

/api/math/isPow2/:number
Description: Returns if an integer is a power of 2 (most of the time)

/api/math/pow3/:number
Description: Returns if an integer raised to the power of 3

/api/math/add9000/:number
Description: Returns an integer plus 9000

/api/math/sub1/:number
Description: Returns an integer minus 1

/api/math/mult10/:number
Description: Returns an integer multiplied by 10

/api/math/divBy5/:number
Description: Returns an integer integer divided by 5

/api/math/plusUltra/:word
Description: Returns an string concatenated with "-Ultra!"

Math Constants

These always return a constant

/api/math/e
Description: Returns Euler's constant

/api/math/ln2
Description: Returns the natural logarithm of 2

/api/math/ln10
Description: Returns the natural logarithm of 10

/api/math/log2e
Description: Returns the base-2 logarithm of E

/api/math/log10e
Description: Returns the base-10 logarithm of E

/api/math/pi
Description: Returns the ratio of the a circle's circumference to its diameter;

/api/math/sqrt1_2
Description: Returns the square root of ½

/api/math/sqrt2
Description: Returns the square root of 2



Source Code