Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deamondev/tyrian-url-dsl-routing
Simple Tyrian application with custom routing mechanism baked in thanks to url-dsl library
https://github.com/deamondev/tyrian-url-dsl-routing
front-end-router routing scala3 scalajs tailwindcss tyrian
Last synced: 18 days ago
JSON representation
Simple Tyrian application with custom routing mechanism baked in thanks to url-dsl library
- Host: GitHub
- URL: https://github.com/deamondev/tyrian-url-dsl-routing
- Owner: DeamonDev
- Created: 2023-05-05T11:04:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-05T12:35:58.000Z (over 1 year ago)
- Last Synced: 2024-11-15T20:37:04.156Z (3 months ago)
- Topics: front-end-router, routing, scala3, scalajs, tailwindcss, tyrian
- Language: Scala
- Homepage:
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hello Tyrian
## What is it?!
This project is related to my Pull Request:
https://github.com/PurpleKingdomGames/tyrian/pull/195
With help of `url-dsl` library I baked simple working front-end routing solution which works pretty well with `Tyrian`. There are several URLs:
1. `/home`
2. `/counter`
3. `/todos`
4. `/id/:userId`, where `userId` is meant to be `Int`
5. `/user` with query parameter `age` (also meant to be `Int`).All the other URLs are redirected to custom `notFound` page. Besides of routing I also added two simple subcomponents to show how to modularize application.
## Setup instructions
To run the program in a browser you will need to have yarn (or npm) installed.
Before your first run and for your tests to work, **you must** install the node dependencies with:
```sh
yarn install
```This example uses Parcel.js as our bundler and dev server, there are lots of other options you might prefer like Webpack, scalajs-bunder, or even just vanilla JavaScript.
We recommend you have two terminal tabs open in the directory containing this README file.
In the first, we'll run sbt.
```sh
sbt
```From now on, we can recompile the app with `fastLinkJS` or `fullLinkJS` _**but please note** that the `tyrianapp.js` file in the root is expecting the output from `fastLinkJS`_.
Run `fastLinkJS` now to get an initial build in place.
Then start your dev server, with:
```sh
yarn start
```Now navigate to [http://localhost:1234/](http://localhost:1234/) to see your site running.
If you leave parcel's dev server running, all you have to do is another `fastLinkJS` or `fullLinkJS` and your app running in the browser should hot-reload the new code.