Websites

The websites module is a prebuild module for all things related to internet websites, this will evolve over time and should save you time if you want to interact with website entities in your own project.

Install

Follow these instructions to use the websites module in your project.

Package

Install the package into your project:

pnpm install @juicyllama/websites

Api Backend

Import the module into your application:

//app.module.ts
import { WebsitesModule } from '@juicyllama/websites'

@Module({
    imports: [
        WebsitesModule,
    ],
})

API Documentation

You can expose the API documentation for websites as follows

//main.ts
import { installWebsiteDocs } from '@juicyllama/websites'

//place this below the swagger setup
redoc = installWebsiteDocs(redoc)

Crons

The websites package has a number of automated processors you can choose to apply to your system depending on your use case.

You can override the default frequency by passing {CRON_NAME}_FREQUENCY passing a CronExpression value (provided by @nestjs/schedule)

For example, if you wanted to invoice clients every month, you could add the following to your .env file

CRON_WEBSITES_SCREENSHOT_GENERATE=1
CRON_WEBSITES_SCREENSHOT_GENERATE="0 0 1 * *"
CronDefault FrequencyDescription
CRON_WEBSITES_WEBSITE_SCREENSHOT_GENERATEEVERY_MINUTEAutomatically generates thumbnail screenshots for any websites without one
CRON_WEBSITES_WEBSITE_ICON_GENERATEEVERY_MINUTEAutomatically generates icons from the websites favicon for any websites without one
Please note that the screenshot and icon generation crons requires a storage package installed, learn more about storage here.

Docs v.0.14.0 Copyright © 2024