Git Product home page Git Product logo

fastify-webpack's Introduction

Technology overview

  • Fastify web server
    • HTTPS enabled (with junk cert/key)
    • HTTP/2 enabled
    • HTTP/2 push enabled via node-fastify-auto-push
      • "It can be thought as a replacement of the fastify-static plugin that supports automatic server-push."

  • Webpack for client-side bundling

Tips for use

Credits

fastify-webpack's People

Contributors

tsnieman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastify-webpack's Issues

Compression (i.e. gzip) not working

Reproduce:

  1. Build webpack
# /path/to/fastify-webpack/client                                        
% npm run build:prod
  1. Start the web server
# /path/to/fastify-webpack/server
% node index.js
  1. Perform an Audit using Chrome Devtools which should show that compression is not working:
    image

Suspected bug: something is preventing "Push"

I suspect that using the lines below,

app.get('/*', (req, reply) => {
reply.sendFile('index.html') // from STATIC_DIR
});

... we are somehow circumventing the auto-push behavior. That said, I've tried removing these lines and using nghttp -ans https://localhost:8080/static/index.html (as well as manual browser testing) and was not able to achieve a "Push".

I was able to achieve a "Push" when I removed the prefix option here:

app.register(
fastifyAutoPush.staticServe, {
root: STATIC_DIR,
prefix: publicPath,
},
);

... (and also had to tweak webpack's publicPath output). This leads me to think maybe prefix is an issue, as I also see some recent commits regarding prefix in the /google/node-fastify-auto-push repo.

I will probably try forking https://github.com/google/node-fastify-auto-push/tree/master/samples/static-page and configure it with a prefix option to further diagnose this issue. If it's a problem with prefix, there might be some clues in this recent commit: google/node-fastify-auto-push@8cde236

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.