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

@gudhub/webserver

v2.0.0

Published

## Server and local development modes

Downloads

2

Readme

README

Server and local development modes

You can use this web server in 2 defferent ways. In server mode and in local development mode:

Local development mode

If you creating website with @gudhub/ssg-website-cli, you need to use local development mode. To do this, you need to install this package globally, with command:

npm i @gudhub/webserver -g

Then, after starting website build, you need to start webserver. In another terminal type:

gudhub-web-server

Server must automaticaly start on 777 port. You can pass flags to customize server:

| Flag | Default | Description | |-----------------|-------------|-----------------------------------------------------------------------------------------------------------| | -p 8000 | 7777 | Start server on specified port (8000 in this case) | | -host localhost | 127.0.0.1 | Start server on specified host (localhost in this case). Can be used to start server on local ip address. |

Server mode

In server mode, you need to clone repo with code, install packages, and configure env. In this mode, you can server multiple websites from websites folder.

All documentation bellow will be about Server mode

Routing

For now, you have few ways of how to add new pages/routes to your website.

By creating html files. You can create html in root of your website folder. In this case, route will be the same as file name. Also, you can create folders, and put your html files there. Each folder will have subdirectory in route. For example, if you will create structure like this: website.com/services/consulting.html, this page will be accessible by this url: https://website.com/services/consulting/. Additionally, you can create structure like this: website.com/services/consutling/index.html and will have same result.

By adding route in routes array in comfig.js. You can also add object like this to routes array in config.js

{
    route: '/services/consulting/', // Route for accessing page
    index: '/whatever/services/consulting.html' // Path to html file, that will be rendered, from root of your website folder
}

By using this example, you will have ability to create dynamic routes. To do this, you must add object like this to routes array.

{
    route: '/blog/:category/:article/', // Route for accessing page. Dynamic parts of route should start from :
    index: '/whatever/blog/article.html' // Path to html file, that will be rendered, from root of your website folder
}

Value of this dynamic parts will be accessible on server side inside query parameters like this: ?category=services&article=why-consulting-is-so-important

Caching

By default, after first visit of page in production mode, will be generated cache for this page. In future visit, only this cache will be served on request, If you want update cache - you need open page with query parameter mode with value ssr: ?mode=ssr. You will receive fresh generated code. Also, this new code will be saved as cache, replacing the old ones. You can disable caching while developing by simply setting MODE env variable to 'development'.