1.0.1 • Published 6 months ago

@packlify/core v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@packlify/core

A core module of the Packlify ecosystem, @packlify/core provides essential utilities and server-side logic for React-based applications.

Table of Contents

Installation

npm install @packlify/core

Features

  • Modular server-side rendering for React components.
  • Device-type recognition middleware.
  • Easy to configure with Vite and Express.
  • Types for server-side and client-side logic.

Usage

Import and initialize server

To create an Express server:

import { createServer } from '@packlify/core';

const app = await createServer();

Use device-type recognition middleware

In your server-side logic:

import deviceMiddleware from '@packlify/core/middleware/device';

app.use(deviceMiddleware);

Render a React component

To render a component on the server-side:

import { renderComponent } from '@packlify/core';

const htmlString = renderComponent({
  Component: YourReactComponent,
  url: '/your-url',
  props: { key: 'value' },
  withRouter: true,
});

Commands

  • packlify-build-server: Build server for production.
  • packlify-dev-server: Run development server.
  • packlify-server: Run production server.

Requirements

  • Node.js (+16)
  • NPM or Yarn
  • TypeScript (recommended)
  • Vite
  • Express

Contact

Lucas Farias lukf95@gmail.com LinkedIn - GitHub

1.0.1

6 months ago

1.0.0

8 months ago

0.0.4

8 months ago

0.0.4-alpha.0

8 months ago

0.0.3-alpha.8

8 months ago

0.0.3-alpha.7

8 months ago

0.0.3-alpha.5

8 months ago

0.0.3-alpha.3

8 months ago

0.0.3-alpha.2

8 months ago

0.0.3-alpha.1

8 months ago

0.0.3-alpha.0

8 months ago

0.0.14-alpha.0

1 year ago

0.0.13-alpha.0

1 year ago

0.0.12-alpha.1

1 year ago

0.0.12-alpha.0

1 year ago

0.0.11

1 year ago