https://github.com/sameerkash/dart-serverstack
Examples showcasing dart server stack with shelf, shelf router, and webdev.
https://github.com/sameerkash/dart-serverstack
dart shelf
Last synced: over 1 year ago
JSON representation
Examples showcasing dart server stack with shelf, shelf router, and webdev.
- Host: GitHub
- URL: https://github.com/sameerkash/dart-serverstack
- Owner: Sameerkash
- Created: 2021-03-16T08:23:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-15T15:22:23.000Z (about 5 years ago)
- Last Synced: 2025-01-18T12:15:08.900Z (over 1 year ago)
- Topics: dart, shelf
- Language: Dart
- Homepage:
- Size: 1.98 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dart Server Stack ✨🎯 🔨
Sample code showcasing usuag of Dart server stack using `shelf`, `shelf_router` and `webdev`.
**Table of Contents**
- [Flutter Conferences](#flutter-conferences)
- [My Pubdev](#my-pubdev)
- [Pub API](#pub-api)
- [Checklist](#checklist)
- [Run Locally](#run-locally)
### Flutter Conferences
All Flutter COnferences in one place! This code showcases building a webapp which serves html using `mustache` templating engine and `scss`. It uses the shelf package to serve files using Pipeline() and Cascade() classes using Middlewares.


### My Pubdev
A personalized clone of pubdev which displays a list of packages fetched from backend. This was built using the `webdev` package and uses dart to manipulate the DOM once packages are fetched from the server.

### Pub API
this project mimics the pub api for fetching packages, it implements appropriate routes using `shelf_router` package and responds with JSON data from a file using the hosted pub repository specification.
**API Endpoints**
| Route | Description | Method |
| -------------------- | ----------------- | ------ |
| /api/ | Test endpoint | GET |
| /api/packages/ | Get all packages | GET |
| /api/package/ | Add a new package | POST |
| /api/package/< name> | Get a package | GET |
| /api/package/< name> | Delete a package | DELETE |
### Checklist
- [x] Server using shelf
- [x] Server using shelf_router with API endpoints
- [x] Serve static files
- [x] Use mustache templating engine
- [x] Compile dart to js using webdev for Client side
- [x] CSS styling using SCSS
- [x] API headers using pub hosted specification
- [x] Add Tests to `shelf_router_example`
### Run Locally
- Clone the repository
- Ensure Dart SDK is installed
- `dart pub get` inside each folder
- Run by either running
```bash
dart bin/server.dart
```
or
```bash
nodemon exec
```
- for running webdev_example,
```bash
dart pub global install webdev
```
and then
```bash
webdev serve
```