0.2.0 • Published 1 year ago

@julikhris/astro-fastify v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Fastify SSR

Fastify Server Side Rendering provider for the AstroBuild Framework. This is being built out as a plugin to be used as part of the JuliKhris lowcode framework which is being build on top of AstroBuild. To leverage Data Islands, Minimal JS and Server Side Rendering.

Although you can use as adapter for AstroBuild. Currently being used for clients on Azure Windows, Azure Linux, Oracle Cloud, and AWS

Coming Soon: 1) Extraction of viteFastifySSRPlugin into its own repo\vite plugin currently resides in index.ts 2) Test scripts

Special thanks to @matthewp/astro-fastify; this is an extension of that adapter writing in TS with additional parameters for customization.

Authors

Installation

Install @julikhris/astro-fastify

npm install @julikhris/astro-fastify

Usage/

//Import the adapter 
// Git Repo Comin Soon!
import adapter from "@julikhris/astro-fastify";

//create a arrow function to build adapter values
// Parameters to pass:
//client relative: variable for relative path to client files example dist\client
// static routes build a colleciton of statice routes css folder etc
// example const 
// getStaticRoutes = (clientRoot) => {
//   console.log("getting static routes")
//  return [
//    {
//      clientRelative:clientRoot,
//      root: "assets",
//      prefix: "/assets/",
//      setHeaders(res) {
//        res.setHeader("Cache-Control", "max-age=31536000,//immutable");
//      },
//      decorateReply: true,
//    }
//  ]
//  }
// server routes to run in dev only
// server routes to run in prod
// port to listen on Azure windows will default to path as it used named pipes
// plugin hooks that attaches to Fastify onrequest hook: for example inject auth hander

const useFastifyAdapter = (
  clientRelative,
  staticRoutes,
  devRoutesApi,
  productionRoutesApi,
  port,
  pluginHooksApi
) => {
  return adapter({
    clientRelative,
    staticRoutes,
    devRoutesApi,
    productionRoutesApi,
    port,
    pluginHooksApi,
  });
};

// add adapter to astro.config
 adapter: useFastifyAdapter(
    clientRelative,
    getStaticRoutes(clientRelative),
    await getServerRoutes(),
    pathToFileURL(resolvedServerRoutesPath),
    serverPort,
    pathToFileURL(resolvedServerHooksPath)
  ),

Documentation

Coming Soon

Support

Coming Soon

Contributing

Contributions are always welcome!

Coming Soon

0.0.57-1

1 year ago

0.0.57-0

1 year ago

0.0.62

1 year ago

0.0.59

1 year ago

0.0.54

1 year ago

0.2.1-0

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.2.0

1 year ago

0.0.53

1 year ago

0.0.52

1 year ago

0.0.51

1 year ago

0.0.50

1 year ago

0.0.48-9

1 year ago

0.0.48-8

1 year ago

0.0.48-5

1 year ago

0.0.47

1 year ago

0.0.46

1 year ago

0.0.45

1 year ago

0.0.42

1 year ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.39

1 year ago

0.0.38

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.30

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago