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

generator-expressjs-rest

v1.9.0

Published

yo template for an ExpressJS application

Downloads

218

Readme

Generator Expressjs Rest

Build Status

Features

  • User Registration
  • Basic Authentication with username and password
  • Admin use react-admin
  • Oauth 2.0 Authentication
    • Facebook
    • Google
  • Upload Photo to S3 amazon
  • Docker

Prerequisites

Installation

Fist, install Yeoman and generator-expressjs-rest using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-expressjs-rest

Generators

Then, you can use yo to generate your project.

yo expressjs-rest # generate a new project
yo expressjs-rest:api # generate a new api endpoint inside your project

Commands

After you generate your project, these commands.

cd your-project-name
mv .env.example .env

docker-compose build
docker-compose run --rm client yarn build
docker-compose up

Playing locally

Deploy

Directory structure

Overview

src/
├─ api/
│  ├─ auth/
│  │  ├─ index.js
│  │  ├─ auth.service.js
│  │  ├─ auth.validation.js
│  │  ├─ auth.controller.js
│  │  └─ auth.test.js
│  ├─ uploads/
│  │  ├─ index.js
│  │  ├─ upload.controller.js
│  ├─ users/
│  │  ├─ index.js
│  │  ├─ user.controller.js
│  │  ├─ user.validation.js
│  │  ├─ user.model.js
│  │  ├─ user.service.js
│  │  └─ user.test.js
│  └─ index.js
├─ services/
│  ├─ index.js
│  ├─ jwt.js
│  ├─ logger.js
│  ├─ mailgun.js
│  ├─ mongoose.js
│  ├─ passport.js
│  ├─ response.js
│  ├─ s3.js
│  ├─ swagger.js
│  └─ your-service.js
├─ app.js
├─ config.js
└─ index.js

src/api/

Here is where the API endpoints are defined. Each API has its own folder.

src/api/some-endpoint/model.js

It defines the Mongoose schema and model for the API endpoint. Any changes to the data model should be done here.

src/api/some-endpoint/controller.js

This is the API controller file. It defines the main router middlewares which use the API model.

src/api/some-endpoint/index.js

This is the entry file of the API. It defines the routes using, along other middlewares (like session, validation etc.), the middlewares defined in the some-endpoint.controller.js file.

services/

Here you can put helpers, libraries and other types of modules which you want to use in your APIs.

TODO

  • Support optional phone authentication
  • Support optional email confirmation process
  • Support Twitter and other social login methods
  • Socket.io support

PRs are welcome.

Credits

@minhuyen and all contributors

License

MIT © minhuyen