Giter VIP home page Giter VIP logo

examples's People

Contributors

dummdidumm avatar karimfromjordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

Svelte(Kit) websocket example

Similar to #3. and a very frequently asked question on Discord. I'm not sure however if this example should use plain websockets or the socket.io library. And to make this example self contained we probably have to use the Vite development server to setup the websocket server and mention that you need a separate websocket server in production.

For the actual content, would a simple chat app to demonstrate the bidirectional nature of websockets be too much for an example? Also, this example could use either plain Svelte or SvelteKit. I think the most important part to show here would be how to manage a websocket connection with a custom store. And if it's a chat app the store could just be extended with a store.send_message() function.

SvelteKit Search and Filter Page Example

This surprisingly came up several times this week on Discord โ€” a page that should fetch, filter and search some data through a <form> and search params in load. My idea was a simple products, words, fruits etc. page which:

  • allows you to filter items by type using checkboxes
  • has a <input type="search" /> to search for specific items
  • when JS is available <input type="search" /> submits the form on:input (debounced)
  • checkboxes etc. submit the form on:change
  • products/words are stored in an array or Map that acts as a database

SvelteKit file upload example(s)

One question that regularly comes up is how to handle file uploads in SvelteKit. Maybe this could be broken down into four examples.

  1. Uploading small files with Node.js
    • use enhanced form action
    • write file to disk with Node.js
    • add a files/+server.js route to demonstrate how to serve user uploaded files
  2. Uploading large files with Node.js
    • use only JavaScript for this to calculate and show a progress indicator with a custom store
    • use XMLHttpRequest because fetch does not support progress calculation yet
    • write file to disk with Node.js
    • add a files/+server.js route to demonstrate how to serve user uploaded files
  3. Uploading small files to S3 compatible storage
    • Use the AWS S3 SDK
    • proxy it through Svelte Kit instead of responding with a presigned URL so that it also works without JS
  4. Uploading large files to S3 compatible storage
    • Use the AWS S3 SDK
    • upload through a presigned URL from the frontend
    • show a progress indicator using a custom store
    • use XMLHttpRequest because fetch does not support progress calculation yet

For the UI each example could show a simple form with a file input and upload button. Underneath it we could show a list of uploaded files, optionally with a delete button.

Sveltekit Blog Example

A minimal blog with simple DX that supports markdown would be a great addition.

  • the example is focused on a specific use case or technology
  • the example is self-contained and easy to grasp
  • the example is stable and does not require much maintenance

Page Transitions Example

SvelteKit makes it really easy to do page transitions with svelte/transition. It would be cool to have a go-to example for this. This is how I've been doing it, but would love to know if there's a better way:

transition.mov

  • the example is focused on a specific use case or technology
  • the example is self-contained and easy to grasp
  • the example is stable and does not require much maintenance

SvelteKit SSE example

I'm not sure how complex an SSE (Server Sent Events) example should be. But since the actual SSE part on the backend is super simple we could combine it with a toast component to make it more "real world". SSE and websockets are also great to demonstrate custom stores.

  • use a +server.js route to return a ReadableStream response for the SSE connection
  • use a custom store to listen for any incoming messages/events
  • include a minimal but complete toast component to display the messages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.