npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

riot-4-fun

v0.2.1

Published

riot-4-fun is a HTTP server framework.

Downloads

8

Readme

riot-4-fun

Let's play riot 4+, FOR FUN.

It is JUST for fun.

I try to have a HTTP server solution for my only need, so there is no much wise choice or best practice.
Everything recalls a simple concept - easy using and fun for developer.

This project uses

Features

Multiple components in one single file

For eaiser code arrangement, we want to tear the whole component as several parts. For example a complex li in ul. But we clearly know that all parts work together and won't needed for any others, it is really unnecessary to have another files for these parts. So we can simply write code as followed:

<part1>
  This is custom component 1.
</part1>

<part2>
  This is custom component 2.
  <script>
    export default {
      components: { part1 }
    };
  </script>
</part2>

<final>
  <part1/>
  <part2/>
  This is the component which will be exported as the default.

  <script>
    export default {
      components: { part1, part2 }
    };
  </script>
</final>

Be awared that the last compnent in the file will be the real export default component after compiling.

Support Store/Context.

For easier handling datas as context/store acrossing components, here provide a simple <store> component which bases on riot plugin.

<component>
  Let's try "store" - {count}.
  <store name='SAMPLE_STORE' listener={SampleStoreListen}/>
  <script>
    import store from 'riot-4-fun/SRC/Store.riot';

    export default {
      components: { store },
      state: {
        count: 0
      },
      SampleStoreListen (store, params) {
        const { count } = store;

        this.update({ count });
      }
    };
  </script>
</component>

One Js file to configure everything.

riot-4-fun needs only one Js file to configure route, resource, page, and everything.

import Http from 'riot-4-fun/SRC/Http.js';
import homePage from './src/lib/homePage.js';
import signIn from './src/lib/signin.js';

const R4F = { // riot-4-fun config.
  port: 3000,
  page: {
    '/home': {
      title: '',
      description: '',
      keywords: '',
      author: '',
      favicon: '',
      feed: '',
      css: [ '/style.css' ],
      js: [ '/library.js' ],
      body: {
        type: 'riot',
        component: './src/components/home.riot',
        Initialize: homePage,
      }
    },
    '/page1': {
      body: {
        type: 'riot',
        component: './src/components/page1.riot'
      }
    }
  },
  errorPage: {
    '404': {
      ...DftPgRt,
      title: '404',
      body: { type: 'riot', component: './src/components/error404.riot' }
    },
    '500': {
      title: '500',
      body: { type: 'riot', component: './SRC/components/error500.riot' }
    }
  },
  service: {
    '/signin': {
      post: signIn
    }
  },
  route: [
    {
      path: 'favicon.ico',
      type: 'resource',
      location: './public'
    }
  ]
};

Http.Build(R4F, 'mjs').Initialize(R4F).Run();