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

better-express

v1.1.8

Published

Better Express is an NPM module for creating a custom environment with extra features for Express development.

Downloads

4

Readme

Better Express

Better Express is an NPM module for creating a custom environment with extra features for Express Server development.

Installation

Globally install Better Express

npm install -g better-express

Create your project!

npx better-express app-name

Usage

Once you installed the template project you can start up the express server using the following command:

npm start

Requirements

Better express requires you to have the following software installed:

Node JS

Git

Adding Routes

You can create a new route by creating a new .js file inside the ./routes/ folder with a default export that equals to a new router.

This file should look something like this:

import express from 'express';
const router = express.Router();

router.get('/', (req, res) => {
    res.send('Hello World!');
});

export default router;

Every file in the ./routes/ folder would automaticly be imported and used in the main express server.

If you want to change the name of the route you can also add an additional export with variable called routeName that should equal to the route name.

This should look something like this:

import express from 'express';
const router = express.Router();

router.get('/', (req, res) => {
    res.send('Hello World!');
});

export default router;
export const routeName = 'routeName';

If a routeName is not defined the Better Express would use the file name as the route name.

Ex:

if the file name is hello.js the route is going to be /hello.

Public Folder

Every file in the public folder will be public and available through the /public route.

Nodemon

Better Express uses an NPM module called Nodemon for restarting the server on save(Documentation).

If you have a file that you don't want nodemon to restart when it saves you can add its path to the ignore array on the nodemon.json file.

About Props

You can customize your Better Express experience by changing the props! (the props are basically like settings) In the main directory, you can find a props folder, if you open the file called default.json you can see all of the properties for the application.

Props

Here is a list of all of the props and what they do. In parentheses after each prop is its type, and after that in italics you can see if it is required or not. (Required means you can't leave it blank or as an empty string because it has no default value)

  • Port (Int) Required - This is the port the Better Express application is going use.

  • logRequests (Bool) Required - This lets the application to notify you when the server gets a request.

  • logEvents (Bool) Required - This notfies you when events get triggered (like crash, restart, exit etc).

  • logRestartCause (Bool) Required - This notfies you when more information about a restart event.

  • openTabOnStart (Bool) Not Required - This opens a tab of the Better Express application automaticly when the application starts. Default value:

    true
  • consoleTxtColor (String) Not Required - This is the color of normal text from Better Express in the console. Default value:

    "cyan"
  • consoleVarColor (String) Not Required - This is the color of variables from Better Express in the console.

    Default value:

    "green"
  • consoleAlertColor (String) Not Required - This is the color of alerts from Better Express in the console.

    Default value:

    "white"
  • consoleErrorColor (String) Not Required - This is the color of error messages from Better Express in the console.

    Default value:

    "red"

License

MIT