Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/chialab/synapse
- Owner: chialab
- License: mit
- Created: 2016-05-24T06:51:58.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-07-09T12:33:11.000Z (6 months ago)
- Last Synced: 2024-11-11T21:36:52.408Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 2.25 MB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Synapse • Application framework built on the top of DNA Web Components.---
## 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.