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

Deploy basic API routes #90

Merged
merged 60 commits into from Jun 9, 2022
Merged

Deploy basic API routes #90

merged 60 commits into from Jun 9, 2022

Conversation

VietAnh1010
Copy link
Collaborator

All scripts and files to copy server into client/lib and client/pages/api have been moved to server. Only necessary files for the deployment will be copied.

I will keep the server directory.

Currently, the api/users/[uid] routes support getting users' information, updating users, and deleting users. POST and DELETE requests will only be allowed only if the request is authenticated. Call user.getIdToken() to get the id token of the user, then add authorization: 'Bearer ${idToken}' to the headers of these POST and DELETE requests.

The api/users/[uid]/sites list all sites of a particular user, using a GET request.

The api/sites and api/pages routes are used to create sites and pages, respectively. The model for these request are to be changed as we progress, so currently any fields sent in the request body will be stored.

In this PR, we will concentrate on testing the api/users/[uid] routes and the usage of id token to authenticate POST and DELETE requests.

@joulev
Copy link
Owner

joulev commented Jun 9, 2022

I will keep the server directory.

Come on... WHY??? How on this f*cking actual earth does this make any sense whatsoever? 😭

Disadvantages to using a monorepo to develop one single app

  • We never know how Vercel actually builds the site (which script is ran, in what order, what is the file system, what is uploaded to AWS and what is not, etc.) (yes it is not simply running yarn build). Vercel can simply change how they deploy and all of this will go to waste.
  • We are simply doing a workaround, in a scenario where an simpler, official, standard solution is available.
  • You have to manually handle tsconfig and everything. Bugs will certainly come, this is literally a written invitation to bugs.
  • What if I want to import some configuration from the backend? Or if you want to import some configuration from the frontend?

Advantages to using a monorepo to develop one single app

Copy link
Owner

@joulev joulev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move everything away from packages/server so that we can convert the whole monorepo to a normal repo immediately after merging.

See reasons in #90 (comment). Although they should already be painfully obvious already that I don't need to write them all down.

I will use symlink for easier navigation on my local machine.
@VietAnh1010
Copy link
Collaborator Author

Move everything away from packages/server so that we can convert the whole monorepo to a normal repo immediately after merging.

Done, removed it.

.vscode/settings.json Outdated Show resolved Hide resolved
packages/client/lib/server/firebase/firebaseAdmin.ts Outdated Show resolved Hide resolved
@joulev
Copy link
Owner

joulev commented Jun 9, 2022

Okay sorry for the outburst earlier, I was really angry but I have calmed down now.

Nevertheless, I would like the Orbital code to be as clean and low of workarounds as possible. Something that I can be proud of, even years into the future, instead of workarounds that will inevitably spiral into pieces of spaghetti.

Therefore I do not and will not allow code not meeting my personal standard to be merged to [main] and [prod]. And my personal standard is quite high.

Can't really avoid merge commits every time...

Signed-off-by: Vu Van Dung <joulev.vvd@yahoo.com>
@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #90 (9bd562a) into main (313baea) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #90   +/-   ##
=======================================
  Coverage   98.75%   98.75%           
=======================================
  Files          30       30           
  Lines         403      403           
  Branches       95       95           
=======================================
  Hits          398      398           
  Misses          5        5           
Impacted Files Coverage Δ
packages/client/lib/client/generateCommentHTML.ts 100.00% <ø> (ø)
packages/client/lib/client/getOgImage.ts 100.00% <ø> (ø)
packages/client/lib/client/prism.tsx 100.00% <ø> (ø)
...ages/client/lib/client/tests/setupMediaViewport.ts 100.00% <ø> (ø)

@joulev joulev merged commit 9bd562a into main Jun 9, 2022
@joulev joulev deleted the deploy-with-nextjs branch June 9, 2022 17:42
@joulev joulev added this to Done in ezkomment project Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants