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

Site: Migrate to Polka #2478

Merged
merged 8 commits into from
Apr 25, 2019
Merged

Site: Migrate to Polka #2478

merged 8 commits into from
Apr 25, 2019

Conversation

lukeed
Copy link
Member

@lukeed lukeed commented Apr 22, 2019

Relies on #2476 in order to be functional because serve-static wasn't actually declared as a dependency, so removing express removed it intrinsically.

I've only not tested auth/login (passport + express-session compat) because I don't have the tokens locally to test it.

Added @polka/send (next version) to handle responses uniformly. Not sure if the all the varying formats were done over time or by different people 😄 In any event, polka/send will autocast to JSON and will autoset Content-Type and Content-Length. It also does a few other things that we're not using here.


Marking as "Draft" until the session/passport stuff can be checked out.

@codecov-io
Copy link

codecov-io commented Apr 22, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@48ebaac). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2478   +/-   ##
=========================================
  Coverage          ?   91.83%           
=========================================
  Files             ?        1           
  Lines             ?       49           
  Branches          ?        0           
=========================================
  Hits              ?       45           
  Misses            ?        4           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48ebaac...050de82. Read the comment docs.

@Conduitry
Copy link
Member

Conduitry commented Apr 22, 2019

You can create some local credentials for yourself for testing by creating a GitHub OAuth app - https://github.com/settings/applications/new - https://github.com/sveltejs/svelte/tree/master/site#repl-github-integration

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

am testing the auth stuff locally now

send(res, 200, json);
Copy link
Member

Choose a reason for hiding this comment

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

isn't there a penalty to stringifying per-response rather than doing it once?

});
if (!example || process.env.NODE_ENV !== 'production') {
example = get_example(slug);
cache.set(slug, example);
Copy link
Member

Choose a reason for hiding this comment

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

same comment re stringifying JSON

@Rich-Harris
Copy link
Member

Not sure I understand why, but /auth/login (declared in src/server.js) is 404ing?

@lukeed
Copy link
Member Author

lukeed commented Apr 22, 2019

Aye, I forgot I had stashed changes at home for a next.2 release, which is needed here.

Technically true about the cached JSON serialization, but removed for declaration consistency. Figured it doesn't really matter because of the 10m+ caching now, plus the internal cache would only be hit once per 10m per region, assuming the GCR instance was still running through the whole hour

@lukeed lukeed marked this pull request as ready for review April 23, 2019 03:07
@lukeed
Copy link
Member Author

lukeed commented Apr 23, 2019

Got the Auth routes running locally. I bummed the values off svelte.dev instead of setting up a separate oAuth app, so aside from the redirect mismatch, all seemed to work out well 👍

I can revert the send + early-JSON changes if desired.

@Rich-Harris Rich-Harris merged commit b4fb2b7 into master Apr 25, 2019
@Rich-Harris Rich-Harris deleted the site/polka branch April 25, 2019 03:26
@Rich-Harris
Copy link
Member

feels good, man

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.

None yet

4 participants