Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acryps/vlserver
VLServer Managed Server
https://github.com/acryps/vlserver
Last synced: 5 days ago
JSON representation
VLServer Managed Server
- Host: GitHub
- URL: https://github.com/acryps/vlserver
- Owner: acryps
- Created: 2020-10-11T07:29:05.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-15T14:17:24.000Z (6 months ago)
- Last Synced: 2024-05-19T06:38:46.124Z (6 months ago)
- Language: TypeScript
- Size: 358 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![npm version](http://badge.acryps.com/npm/vlserver)](http://badge.acryps.com/go/npm/vlserver)
![vlquery](http://badge.acryps.com/vlquery)# vlserver API Binder
vlserver automates api interfaces by automatically binding Services and ViewModels from the server to one or multiple clients.> This package **requires** [vlquery](https://npmjs.com/vlquery).
## Documentation
[Getting Started](doc/getting-started.md)
[Adapters](doc/adapters.md)
[Data Exchange](doc/exchange.md)## Sponsoring and support
This project is sponsored and supported by [inter allied crypsis / ACRYPS](https://acryps.com) and [VLVT.IN GmbH](https://vlvt.in).## Example
Declare view models on the server
```
export class AuthorViewModel extends ViewModel {
id;firstname;
lastname;
}export class BookViewModel extends ViewModel {
id;name;
author: AuthorViewModel;
}
```Create a service on the server
```
export class BookService extends Service {
constructor(
private db: DbContext
) {
super();
}getBooks() {
return BookViewModel.from(this.db.book);
}
}
```You can use the service in your client (after generating the bindings with `vlserver compile`)
```
const service = new BookService();
service.getBooks().then(books => {
console.log(books); // [ BookViewModel, BookViewModel, ... ]
});
```