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

express-booster

v1.1.0

Published

a bootstraping tool to generate production level structured express Api applications

Downloads

18

Readme

Recordit GIF

Key Features

  • project structure generation with Services ,Models, Controllers and Routers
  • auto-required Routes using a user specified endpoint and the Route file name

eg (route : users.js and endpoint: /api this will automount to /api/users)

  • fully implemented Authentication using Passport-jwt
  • suppports mongodb mongoose
  • automatic integration with passport-mongoose
  • helmet package for a more secure express app
  • cors support
  • morgan support for logging
  • nodemon support for Dev

Table of Contents

Contents of this documentation.


Installation

  • npm i express-booster -g

Setup

  • fillout the Configuration at /src/config/config.js:
module.exports = {
  db: {
    dbHostName: "localhost",
    dbPort: 27017,
    dbName: "HelloWorld",
  },
  hostname: "localhost",
  port: process.env.PORT || 8081,
  secretKey: "_Fill_ME_",
};
));

Clone

  • Clone this repo to your local machine using https://github.com/Samielleuch/express-booster.git

How to use

  • In order to use this CLI package simply:
$ express-booster

specify the project name to the CLI tool this will create the folder for your project

make sure the Folder doesn't already exist

specify included packages with < space > according to the chosen options this will generate your project

Files Generation

  • choosing passport-jwt generates /services/passportService.js

  • choosing mongoose generates /models/user.js

  • choosing mongoose and passport-jwt generates :

    • /routers/routes/HelloWorld.js
    • /routers/routes/users.js
    • /controllers/helloWorldController.js
    • /controllers/authController.js

Route Generation

  • using passport-jwt and mongoose will autogenerate the following routes:

lets call Main_endpoint the endpoint created when calling the cli app (defaults to /)

  • POST Main_endpoint/users/signin
  • POST Main_endpoint/users/signUp

these endpoints use the authController and the users route to create jwt authentication login and signup

sign up example

POST request to : /users/signup
{
    "name" : "test" ,
    "phone": 123456789 ,
    "password" : "test" 
  
}
response:
{
    "success": true,
    "status": "Registration Successful!"
}

sign in example

POST request to : /users/signin
{
    "name" : "test" ,
    "phone": 123456789 ,
    "password" : "test" 
  
}
response:
{
    "success": true,
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZjAzOGI3YWM4YTYxZTE4YzVlNDlmM2QiLCJpYXQiOjE1OTQwNjgxMjIsImV4cCI6MTU5NDA3MTcyMn0.Ko2GhbRHpS8Q5i9wBDryYNhYdCbZlir-6iOfRsz1GOE",
    "user": {
        "admin": false,
        "_id": "5f038b7ac8a61e18c5e49f3d",
        "name": "test",
        "phone": 123456789,
        "__v": 0
    }
}
  • GET Main_endpoint/HelloWorld
  • GET Main_endpoint/HelloWorld/protected

this endpoint simulates a protected data using jwt tokens you need to specify jwt token in Header to access the protected resource

access protected data

GET request to : /HelloWorld/protected
provide following Header:

| Key | Value | |---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZjAzOGI3YWM4YTYxZTE4YzVlNDlmM2QiLCJpYXQiOjE1OTQwNjgxMjIsImV4cCI6MTU5NDA3MTcyMn0.Ko2GhbRHpS8Q5i9wBDryYNhYdCbZlir-6iOfRsz1GOE |

response:
{
    "msg": "Hello World with jwt :D "
}

Contributing

This is an opensource project every help would be greatly appreciated To get started...

Step 1

  • Option 1

    • 🍴 Fork this repo!
  • Option 2

    • 👯 Clone this repo to your local machine using https://github.com/Samielleuch/express-booster.git

Step 2

  • HACK AWAY! 🔨🔨🔨

Step 3

  • 🔃 Create a new pull request using https://github.com/Samielleuch/express-booster/compare/.

Creator

Support

Give it a try , Every FeedBack is very appreciated

Reach out to me at one of the following places!


License

License