Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chialab/synapse

⚡️ Application framework built on the top of DNA Web Components.
https://github.com/chialab/synapse

Last synced: about 2 months ago
JSON representation

⚡️ Application framework built on the top of DNA Web Components.

Awesome Lists containing this project

README

        



Synapse logo


Synapse • Application framework built on the top of DNA Web Components.


NPM

---

## Get the library

Install via NPM or Yarn:

```
npm i @chialab/synapse
```

```
yarn add @chialab/synapse
```

## Create an application

```tsx
import { customElement, html, render } from '@chialab/dna';
import { App } from '@chialab/synapse';

@customElement('demo-app')
class DemoApp extends App {
routes = [
{
pattern: '/',
render(req, res) {
return (

Home



);
},
},
{
handler(req, res) {
res.data = new Error('not found');
},
render(req, res) {
return (


${res.data.message}
${res.data.stack}



);
},
},
];

render() {
return (
<>

Synapse 3.0






{super.render()}
>
);
}
}

const app = render(, document.getElementById('app'));

app.start('/');
```

---

## Development

[![Build status](https://github.com/chialab/synapse/workflows/Main/badge.svg)](https://github.com/chialab/synapse/actions?query=workflow%3ABuild)
[![codecov](https://codecov.io/gh/chialab/synapse/branch/main/graph/badge.svg)](https://codecov.io/gh/chialab/synapse)

### Build

Install the dependencies

```
yarn
```

and run the `build` script:

```
yarn build
```

This will generate the ESM and CJS bundles in the `dist` folder and declaration files in the `types` folder.

---

## License

Synapse is released under the [MIT](https://github.com/chialab/synapse/blob/main/LICENSE) license.