Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/finastra/ssr-pages
Builder of html pages for the purpose of SSR (Server-side rendering)
https://github.com/finastra/ssr-pages
Last synced: 20 days ago
JSON representation
Builder of html pages for the purpose of SSR (Server-side rendering)
- Host: GitHub
- URL: https://github.com/finastra/ssr-pages
- Owner: Finastra
- Created: 2021-04-06T13:37:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-15T09:57:26.000Z (almost 3 years ago)
- Last Synced: 2024-11-20T17:46:30.890Z (about 1 month ago)
- Language: TypeScript
- Size: 813 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# SSR Pages builder
Builder of html pages for the purpose of SSR (Server-side rendering).
## Use it
```typescript
import { SSRPages } from '@finastra/ssr-pages';const ssrPagesService = new SSRPages();
const msgPageOpts = {
title: 'SSR example',
subtitle: `This is an example of a server-side rendered content`,
description: 'Built with @finastra/ssr-pages library',
svg: 'exit' as const,
redirect: {
auto: false,
link: '/user',
label: 'Check your user',
},
};
const html = ssrPagesService.build(msgPageOpts);
```And use the generated html as you see fit ;)
## NestJS
To use it in NestJS, simply create an injectable service that extends the SSRPage class.
```typescript
import { SSRPages } from '@finastra/ssr-pages';
import { Injectable } from '@nestjs/common';@Injectable()
export class SSRPagesService extends SSRPages {
constructor() {
super();
}
}
```Inject it in a controller, and use it in an endpoint to return the templated html !
```typescript
constructor(private ssrPagesService: SSRPagesService) {}
@Get('/ssr')
async ssr(): Promise {
const msgPageOpts = {
title: 'SSR example',
subtitle: `This is an example of a server-side rendered content`,
description: 'Built with our @finastra/ssr-pages library',
svg: 'exit' as const,
redirect: {
auto: false,
link: '/user',
label: 'Check your user',
},
};
return this.ssrPagesService.build(msgPageOpts);
}
```