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

xtra-express

v1.1.5

Published

Express But Better

Downloads

2

Readme

Contributors Forks Stargazers Issues MIT License

About The Project

Express is a popular Node.js package useful for many simple tasks that require hosting files online such as a simple website or a api, and Xtra-Express is for the sole purpose of making this package even easier by simplifying tasks that would take hundreds of lines of code if done manually. It will save you time and effort, and will hopefully enhance your website, api or whatever you wish to build.

Prerequisites

NPM is required to run this project

If you do not already have npm you can install it from https://nodejs.org/en/download/

npm install -g npm

Installation

npm install -g xtra-express

Usage

const {express} = require('xtra-express')                               // Import xtra-express
const app = express();                                                  // create app

app.set('view engine','ejs')                                            // Set ejs to view engine
app.use(express.static('xtra-express'))                                 // This is necessary if you want the views chart page

express.init(['index-ejs'])                                             // Initializes all your files

                                                                        // Make sure to replace `.` with `-` in all 
                                                                        // file names you provide to the package
                                           
app.get('/', async (req, res) => {          
    express.viewsUpdate('index-ejs')                                    // Tells the package that a new view has occured
    res.render('index');                                                // Render your content inside the `views` folder as normal
 });

 app.get('/views', async (req,res) => {
    res.render('xtra-express/index-ejs')                                // Render the views chart for the specified file on that path
 })

 app.listen(5001);

Not all functions have been utilised in the simple demo above and futher functions can be seen in the section below

Functions

express.init(['file-name']) 

Initializes all files given in the array for view tracking and the views chart. Processes can also be done individually through the functions below.

express.viewsInit('file-name')

Initializes the view tracking and creates all necessary files

express.chartInit('file-name')

Initalizes the views chart and creates all necessary files. This will create a file at ./views/xtra-express/file-name.ejs, edit this file as per the needs of your site. The chart can be displayed on any route by using res.render('xtra-express/file-name').

To make sure no content gets cut out, only the last 30 days of recorded data will be shown in the chart

express.viewsUpdate('file-name')

Should be placed on the route where you would like to track views. It will be called on every visit, updating the view count each time.

:warning: If you are using nodemon: Nodemon will restart your site on every visit due to the changing of a .json file. To avoid this place the following code in your package.json

 "nodemonConfig": {
  "ignore": ["xtra-express/*/*.json"]
 },
express.views('file-name')

Run at any time to get the current number of views printed in the console. This can also be stored in a variable where it will simply return the number of views

express.serverUptime()

Returns the server uptime in the format days:hours:minutes:seconds. Recommended to put this in either a console.log() or variable.

Demonstration

📊 This feature is made possible by the Google Charts Api

Contributing

Contributing will help keep this project alive and is greatly appreaciated. If you would like to contribute please follow the steps below.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.md for more information.

Documatic

Documatic is a search engine for your codebase; Ask documatic a question and find relevant code snippets and insights in seconds.

https://www.documatic.com/ Documatic acts as a search engine for your codebase; once you describe what you're looking for, Documatic pulls up related code or documentation making it easier to find what you're looking for in seconds!

Not sitting next to each other? No problem. Ask Documatic questions of your codebase to learn and understand your code in seconds. Documatic is the team member you wish you had

Our Visual studio Code extension: https://marketplace.visualstudio.com/items?itemName=Documatic.documatic