Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement Next.js server (#2) #1

Conversation

aahna-ashina
Copy link
Member

@aahna-ashina aahna-ashina commented May 13, 2022

https://app.dework.xyz/nation3/app-2?taskId=2a5ceb0e-ed0f-43ef-a211-16830aaba13f


Implement Next.js server

  • 6835dbe refactor: change extensions from .js to .ts
  • ee5a62a Add ESLint config ("Strict")
  • 4ea62d5 Set strict TypeScript mode
  • 97eca07 Add TypeScript interfaces
    • ApplePass
    • GooglePass

Server Build and Deployment

  • Configure server deployment in Vercel
    • Create new project in Vercel
    • Add environment variables in Vercel

Download Pass - /api/downloadPass

Connect Wallet and Initiate Pass Download

Push Notification - /api/pushNotification

Push Template Update - /api/pushUpdate

Documentation

  • Document the functionality of each REST API endpoint
    • /api/downloadPass
    • /api/pushUpdate: Document the steps for updating the pass template
    • /api/pushNotification: Document the commands for pushing a notification

@aahna-ashina aahna-ashina changed the title dw-43/implement-nextjs-server feat: dw-43/implement-nextjs-server May 13, 2022
Add API endpoint: `/api/pushUpdate`
Add API endpoint: `/api/pushNotification`
@luisivan
Copy link
Contributor

luisivan commented May 13, 2022

Thanks a lot! This is a great starting point. A few comments:

  • We indeed use wagmi so far, so we should keep using it
  • I'm thinking that it would make sense to implement the API here, and then implement the frontend part directly in nation3/app. That way, we can reuse all the existing styling/utilities (like connecting the user's wallet). Any thoughts?

npm install wagmi ethers
Implement "Connect Wallet" functionality
@aahna-ashina
Copy link
Member Author

aahna-ashina commented May 14, 2022

  • I'm thinking that it would make sense to implement the API here, and then implement the frontend part directly in nation3/app. That way, we can reuse all the existing styling/utilities (like connecting the user's wallet). Any thoughts?

@luisivan All right, that makes sense. So this Next.js server will purely be a REST API, with no visible UI 👍

A few follow-up questions about this:

  1. Will the /api/downloadPass requests coming from the nation3/app be HTTP GET or HTTP POST requests?
  2. When the /api/downloadPass request is successful, should the pass file be returned directly in the response body?
  3. When the /api/downloadPass request is unsuccessful (e.g. invalid address or signature), what type of response should be returned? I'm assuming an HTTP error status code with a JSON response body explaining the error?

@aahna-ashina aahna-ashina mentioned this pull request May 14, 2022
24 tasks
@aahna-ashina aahna-ashina changed the title feat: dw-43/implement-nextjs-server feat: implement next.js server (#2) May 14, 2022
@aahna-ashina aahna-ashina changed the title feat: implement next.js server (#2) aahna-ashina/dw-43/implement-nextjs-server May 14, 2022
`npm install typescript --save-dev`
`npm install --save-dev @types/react @types/react-dom @types/node`
Refactor from `types.ts` to `interfaces/index.ts`
@aahna-ashina aahna-ashina changed the title aahna-ashina/dw-43/implement-nextjs-server feat: implement next.js server (#2) May 16, 2022
@aahna-ashina aahna-ashina changed the title feat: implement next.js server (#2) dw-43/implement-nextjs-server (#2) May 16, 2022
Add TypeScript interfaces: `ApplePass` and `GooglePass`
@luisivan
Copy link
Contributor

  1. Will the /api/downloadPass requests coming from the nation3/app be HTTP GET or HTTP POST requests?

I'd say GET makes more semantic sense.

  1. When the /api/downloadPass request is successful, should the pass file be returned directly in the response body?

I think so, with the correct MIME type defined so it triggers a download.

  1. When the /api/downloadPass request is unsuccessful (e.g. invalid address or signature), what type of response should be returned? I'm assuming an HTTP error status code with a JSON response body explaining the error?

Exactly.

@aahna-ashina aahna-ashina changed the title dw-43/implement-nextjs-server (#2) Implement Next.js server #2) May 21, 2022
@aahna-ashina aahna-ashina changed the title Implement Next.js server #2) Implement Next.js server (#2) May 21, 2022
@aahna-ashina aahna-ashina changed the title Implement Next.js server (#2) feat: Implement Next.js server (#2) May 21, 2022
`npm uninstall react-dom`
`npm uninstall react`
`npm uninstall @types/react-dom`
@aahna-ashina aahna-ashina merged commit 3691830 into nation3:main May 24, 2022
@aahna-ashina aahna-ashina deleted the aahna-ashina/dw-43/implement-nextjs-server branch May 24, 2022 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants