This is a Next.js project bootstrapped with create-next-app
.
First, run the development server (we'll use yarn for consistency):
yarn dev
Open http://localhost:3000 with your browser to see the result.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
First, create a free Heroku PostgreSQL database. This will make it easy to configure a DB for testing without configuring a database on your local computer.
Next, create a .env file with the same format as .env.example, and replace the DATABASE_URL value in your .env with the DATABASE_URL of your Heroku DB (found in your Heroku settings)
Then, use the following instructions to configure Prisma with your Heroku DB:
- Run yarn prisma db push to create the DB tables as specified in schema.prisma
- Run yarn prisma studio to view the DB tables and easily add/delete dummy data
If you don't want to create a Heroku database, you can just create a local PostgreSQL DB and do the following:
- Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb.
- Run yarn prisma db push to create the DB tables as specified in schema.prisma
- Run yarn prisma studio to view the DB tables and easily add/delete dummy data
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.