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

node-rem

v0.6.2

Published

Node REM - NodeJS Rest Express MongoDB and more: typescript, passport, JWT, socket.io, HTTPS, HTTP2, async/await, etc.

Downloads

25

Readme

Node REM

NodeJS Rest Express MongoDB

Build Status Codacy Badge

🌟 It rains ~~cats and dogs~~ features:

  Typescript      Express 4.15       CORS     Helmet    DotEnv   joi (validation)   forever
  Mongoose 4.9    Passport  JWT      Await
  Tslint          Apidoc    Docker   Husky    Morgan    Travis
  Tests
            Mocha  Chai     Sinon    istanbul
  MORE:
            HTTPS           HTTP2 (spdy)      Socketio 2.1       Slack message
            Nodemailer      Mailgun           Email Templates    File upload (multer)
            VSCode Debug    Dependabot        Codacy
      API
            API response    (data, meta: limit, offset, sort)    Transform res
            apiJson         Pagination query      Whitelist fields in response
            mstime          API response time     Stack trace in Response
  • More details in Feature Documentation
  • If you don't want Typescript, use this branch: node-rem-without-typescript

📦 Installation

Clone this project:

git clone https://github.com/ngduc/node-rem.git your-app
cd your-app
rm -rf .git
yarn
  • Update package.json and .env file with your information.
  • Run yarn dev, it will create a new Mongo DB "node-rem"
  • Verify: use Postman to POST https://localhost:3009/v1/auth/register to create a new user. (set payload to have email, password)

🔧 Commands

Require: MongoDB and NodeJS v8.12.0 +

yarn dev      launch DEV mode
yarn start    launch PROD mode
yarn stop

yarn test     Run tests

📖 Features

Your simple API Route Handler will have a nice syntax like this: (packed with ~~vitamins~~ cool stuffs)

exports.list = async (req: Request, res: Response, next: NextFunction) => {
  try {
    const data = (await User.list(req)).transform(req); // query & run userSchema.transform() for response
    apiJson({ req, res, data, model: User }); // return standard API Response
  } catch (e) {
    next(e);
  }
};

API Response is similar to JSON API standard:

GET https://localhost:3009/v1/users?fields=id,name (get id & name only in response)
GET https://localhost:3009/v1/users?role=admin&page=1&perPage=20 (query & pagination)
GET https://localhost:3009/v1/users?role=admin&limit=5&offset=0&sort=email:desc,createdAt
{
    "meta": {
        "limit": 5,
        "offset": 0,
        "sort": {
            "email": -1,
            "createdAt": 1
        },
        "totalCount": 4,
        "timer": 3.85,
        "timerAvg": 5.62
    },
    "data": [
        {
            "id": "5bad07cdc099dfbe49ef69d7",
            "name": "John Doe",
            "email": "[email protected]",
            "role": "admin",
            "createdAt": "2018-09-27T16:39:41.498Z"
        },
        // more items...
    ]
}

Example of generated API Docs (using apidoc) - https://node-rem.netlify.com

📖 Documentation

🙌 Thanks

All contributions are welcome!

danielfsousa/express-rest-es2017-boilerplate