A very simple test of Next.js, using Prisma for the database.
Cry your eyes out with the style.
You will need a local server to run this.
- Modify the .env file to your liking
- Start a local server of your liking
- Do the Prisma stuff (of your liking)
- Populate the DB with some values of your liking
npm run dev
[of your liking]
- GET - Returns all users
- POST - Inserts a new user
- DATA: name, email, username, password
- GET - Returns the specified user
- DELETE - Deletes the specified user
- PATCH - Updates the specified user data
- GET - Returns all posts from the specified user
- GET - Returns all posts
- POST - Inserts a new post into the database
- DATA: author_id (user ID), title, content
- GET - Returns the specified post
- DELETE - Delete the specified post
- PATCH - Updates the specified post
- DATA: title, content
Confused by the JSON.parse(JSON.stringify(data))
in the return props? Reason.