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 🙏

© 2026 – Pkg Stats / Ryan Hefner

suissard-api

v1.0.2

Published

Systeme d'api de suissard

Readme

suissard-api

Systeme d'api prêt l'emploi

Instancier un api avec un object de config qui contient un hostname et un port. il est possible d'ajouter des parametres lié a discord, qui serviront a authentifier formellement l'utilisateur

const { Api } = require("suissard-api")

const config = { hostname:"myapidomain.dev", port: 8080 }
const discordConfig = { 
    clientId: "123456789", 
    clientSecret:"1a2z3e4r5t6y7y8u9i", 
    redirectUrl: "https://myapidomain.dev:8080/auth" // The url where you can handle the discord code
}

const api = new Api(config, discordConfig)

Ensuite, creer des routes et les fonctions associés. La fonction receverra en argument : la requete, le resultat, l'identifiant de l'utilisateur (false si il n'est pas reconnu) et l'object api (qui contient les utilisateurs et les hash de leur token)

const { Route } = require("suissard-api")

new Route(api, /\/ping/, "get", (req, res, userId, app) => {
    if (userId) res.send(`Hello utilisateur ${userId}`)
    else if (userId === false) res.send(`Hello utilisateur anonyme`)
});

Il est possible de surcharger la methode d'authentification pour utiliser un autre systeme que celui implanté

const api = new Api(config)

api.authentication= (req, res) => {
    if (req.headers.password == "myStrongPassword") return "bigBossId"
    else return "looserId"
}

Concernant l'authentication discord, les infos "clientId", "clientSecret" sont en provenance de https://discord.com/developers/applications. C'est égalemebnt la-bas que vous renseignerez votre url de redirection (celle vers laquelle discord renvera l'utilisateur apres qu'il ai donné les acces, en enrichissant l'url d'un query code) Bref, l'utilisateur clique sur l'url fournit par Api.getDiscordAuthUrl(), s'authentifie et seras redirigé vers "redirectUrl" (que vous devrez avoir préalablement renseigné sur leur site, exemple: "https://myapidomain.dev:8080/auth") A partir de là, l'api renvoie un token, qui permttra au client de s'authentifier pour la suite :)