Node server configuration

Hello! I’m trying to make a custom configuration of node sever but I don’t understand very well how is creating the server. For example, I need to add a compression for the HTML that is sent to to the visitor browser.

I don’t understand very well the difference between the serve.ts and the serve.js. Also I see the build/server.js is a minified file.

First of all, sorry for the lack of documentation. We are going to release more this week.

But to answer to your question: frontity build creates two things:

  • A final /build/server.js file.
  • A /build/static folder with other .js files and assets.

The /build/server.js is your server. You can either upload it to a serverless hosting or start it with frontity serve in your own Node.

The /build/static folder are the files that you will send to the client. They are served using the frontity serve command or you can upload them to a static server or a CDN.

We didn’t want to include it in the core because sometimes is better to leave that task to Nginx or your CDN. But we are going to release a @frontity/compress package that adds compression to the Frontity server itself. Actually, it’s one of the first server packages we want to release along with others like @frontity/headers.

Yes, build/server.js is ready for production :slight_smile:

2 posts were split to a new topic: Webpack’s HMR (hot module replacement) endpoint not found