ECarry / photography-website-nextjs14

An open-source Photo Blog📸🌟 built using Next.js 14, Drizzle, postgresql, Auth.js V5, Shadcn/ui and Hono.js.
https://p.ecarry.me
58 stars 6 forks source link

Question about uploading image #2

Closed CallMeL closed 6 months ago

CallMeL commented 6 months ago

Hi there! Excuse me for taking your time again. I tried to add photo record on prisma, but in the home page it shows no data.

Screenshot 2024-03-01 at 21 27 15 Screenshot 2024-03-01 at 21 27 29

I'm not sure whether the localhost:5555 is the right place to upload images, or there is another dashboard page for uploading, especially after we deploy the website using Vercel.

Many thanks for your time and help!

ECarry commented 6 months ago

Hi there! I have fixed the issue you provided.

You need to perform the following steps:

  1. You should go to the dev dir and perform a git pull to fetch the latest code to your local.
  2. Regarding image uploading, you need to register an account on UploadThing (free 2GB) and fill in the API key in the .env file. Then, back your site, log in to the/dashboard, go to the gallery to upload images.

If you are deploying on Vercel, you need to go to Settings and set up Environment Variablesby providing the corresponding Key and Value. Make sure to set NEXTAUTH_URLto the deployment address on Vercel, rather than http://localhost:3000/.

CallMeL commented 6 months ago

@ECarry Thanks for the reply!

In the /dashboard page, what is the password for it? I tried the password set in http://localhost:5555, but it says Invalid credentials!, should I set in the .env file?

Thanks again!

ECarry commented 6 months ago

password: Password use bcrypt hash, you can generate at https://bcrypt.online/ and Then copy the generated code to http://localhost:5555 User model password

Of course, you can set up the username, password and email in advance in the .env file. You can see the new additions

# init user
USER_EMAIL = test@test.com
USERNAME = test
USER_PASSWORD = test

in the .env.example file, but you need to git pull the latest code first and go to http://localhost:5555 to delete your old account.

CallMeL commented 6 months ago

Thank you so much! It solved my problem perfectly!