Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
docs/generated
file-output
.vscode
src/di/default/temp
src/di/default/temp
.env
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Zibri is an opiniated typescript backend framework based on express. It's heavily inspired by frameworks like [LoopBack](https://loopback.io/doc/en/lb4/index.html) and [Nest](https://docs.nestjs.com/).

What differentiates it from such frameworks can be found in our [goals section](#goals).
What differentiates it from such frameworks can be found in our [goals section](#-goals).

# 📑 Documentation
The official documentation of Zibri can be found under [https://service-soft.github.io/zibri](https://service-soft.github.io/zibri)
Expand Down Expand Up @@ -54,7 +54,7 @@ With Zibri you can rely on a strong foundation of battle tested libraries that h
- express as the server
- typeorm for handling everything database related
- nodemailer for sending emails
- handlebars for templating
- handlebars and preact for templating
- busboy for file uploads (the foundation of multer)
- socket.io for websockets
- node-cron for cron jobs
Expand Down
7 changes: 1 addition & 6 deletions docs/http-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import { HttpClientInterface, inject, ZIBRI_DI_TOKENS } from 'zibri';
// ...
const http: HttpClientInterface = inject(ZIBRI_DI_TOKENS.HTTP_CLIENT);
// undefined is assumed for the response body because we did not define anything
const response: HttpClientResponse<undefined> = await http.get(
'https://some-api.com/tests',
{

}
);
const response: HttpClientResponse<undefined> = await http.get('https://some-api.com/tests');
// ...
```

Expand Down
6 changes: 3 additions & 3 deletions docs/templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ These are also hot reloaded when you change your templates and eg. introduce or
# Pages
For simple html pages Zibri uses [preact](https://preactjs.com/), but with some [heavy modifications](#additional-functionality).

This system is pretty great for a server side framework to render some basic pages. If you have more advanced use cases you should however you will probably be better of by creating a separate client application that consumes the Zibri API.
This system is pretty great for a server side framework to render some basic pages. If you have more advanced use cases however you will probably be better of by creating a separate client application that consumes the Zibri API.

```ts
import { Controller, Get, GlobalRegistry, HtmlResponse, PreactUtilities, Response } from 'zibri';
Expand Down Expand Up @@ -115,7 +115,7 @@ NO imports are resolved automatically.

This means that you can't simply leak server side secrets like api keys to the client just because you used `environment.apiUrl` somewhere and the `index.ts` where its imported from also contains some secrets that tsx compiles into the code. (A reoccuring problem with frameworks that mix the line between front- and backend)

But this also means that the functionality is a lot more restrictive than React, because every hook has to be custom provided. There are currently only two hooks available: `onClient` and `onServer`. Everything else that you might know (useState etc.) simply won't work.
But this also means that the functionality is a lot more restrictive than React, because every hook has to be custom provided. There are currently only two hooks available: `onClient` and `onServer`. Everything else that you might know (useState etc.) simply won't work (yet).

Let's take the metrics page as an example (full content down below), because we have a lot of client functionality that gets restored.
The first thing you will probably notice is the strange import at the start of the file:
Expand Down Expand Up @@ -143,7 +143,7 @@ let snaps: MetricsSnapshot[] = [];
let automaticReload: boolean = true;

// the onClient hook provides a way to mark logic that should only be called on the client.
// In this case window would throw an error on the server side, because it does not exist there.
// In this case, window would throw an error on the server side, because it does not exist there.
onClient(() => {
window.addEventListener('load', () => {
void loadSnapshots();
Expand Down
2 changes: 1 addition & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
bail: false,
modulePathIgnorePatterns: ['tmp'],
// testPathIgnorePatterns: ['<rootDir>/data-source/transaction/transaction.test.ts'],
testPathIgnorePatterns: ['<rootDir>/plugin/payment/providers/pay-pal/pay-pal.payment-provider.test.ts'],
// coverage
// collectCoverage: true,
coverageProvider: 'v8',
Expand Down
Loading
Loading