Socket
Book a DemoInstallSign in
Socket

jetpack-serve

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jetpack-serve

Jetpack's standalone middleware for serving built bundles

latest
Source
npmnpm
Version
3.1.0
Version published
Maintainers
1
Created
Source

jetpack-serve

This is an express middleware for serving up bundles created by jetpack.

Use this in your app if you don't want to install/require the entire jetpack bundler in your production app.

Usage

Once the app is bundled:

$ jetpack build

You can serve it in your express application:

const express = require('express')
const jetpack = require('jetpack-serve')

const app = express()

app.get('/api/data', (req, res) => {
  res.send('hello')
})

app.use(jetpack())

app.listen(3000, function() {
  console.log('Running server on http://localhost:3000')
})

Options

Jetpack takes the following options:

  • dist - default: "dist"
  • env - default: the value of process.env.NODE_ENV, set to "production" to serve built bundle from dist

This package handles jetpack's differential builds! That is a modern or legacy bundle will be served based on the user agent of the browser.

FAQs

Package last updated on 05 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts