Skip to content

ntuee-web-programming/112-1-hack2

Repository files navigation

Run the project

Install dependencies

yarn

Environment variables

Create a .env.local file in the root of the project and add the following variables:

POSTGRES_URL=postgres://postgres:postgres@localhost:5432/hack2

AUTH_SECRET=<ANY_RANDOM_STRING>
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=

NEXT_PUBLIC_BASE_URL=http://localhost:3000

Get Github OAuth credentials (Optional)

本次考試不會評分 Github 登入的部分,但是如果懶得打帳號密碼,可以參考以下步驟:

  • Go to Settings tab of your Github account

  • Click Developer settings on the left sidebar

  • Click OAuth Apps on the left sidebar

  • Click New OAuth App

  • Enter the following information:

    • Application name: Notion Clone (or any name you like)
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:3000/api/auth/callback/github
  • Click Register application

  • Copy the Client ID and Client Secret to your .env.local file:

    AUTH_GITHUB_ID=<Client ID>
    AUTH_GITHUB_SECRET=<Client Secret>
    

    Note that in NextAuth v5, the prefix AUTH_ is required for the env variables.

    Note that you do not have to add those keys to src/lib/env/private.ts since they are automatically handled by NextAuth.

Database

  1. Start database
docker compose up -d
  1. Run migrations
yarn migrate

Start the server

yarn dev

Setup tests

yarn playwright install chromium # Install Chromium (if not already installed)
yarn playwright install-deps chromium # Install Chromium dependencies (if not already installed)

Run tests

yarn test

題目說明

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors