2.1.3 • Published 4 months ago

nemjs v2.1.3

Weekly downloads
-
License
Apache-2.0 Licens...
Repository
github
Last release
4 months ago

nemjs

JavaScript Backend Service Library

NPM Version

NPM Downloads GitHub Last Commit

Codacy Badge Maintainability

GitHub Top Language Code Size

Overview

nemjs is a JavaScript Backend Service Library.
You will find some Services about Checkers, Getters & Setters
Auth services are using JWT & bcrypt
Mail services are using nodemailer
Image services are using sharp

Summary


Package

NPM : npm i nemjs
Yarn : yarn add nemjs


Download

Latest Release
or
git clone https://github.com/philippebeck/nemjs.git
or
Master ZIP


Content

Checkers part :

  • checkAuth(req, res, next) : check JWT auth to routes
  • checkEmail(email) : check email validity
  • checkPass(pass) : check password validity
  • checkRange(value, min, max) : check number|string range with min/max
  • checkUrl(url) : check url validity

Getters part :

  • getName(name) : get kebab-case name
  • getPosterName(name) : get image name for gallery cover
  • getMailer() : get mailer with nodemailer
  • getMessage(message) : get message
  • getPassword() : get generated password

Setters part :

  • setAuth(pass, user, res) : set JWT
  • setImage(inputImg, outputImg, width, height) : set image
  • setThumbnail(inputImg, outputImg, width, height) : set thumbnail

Usage

  1. Copy the .env.example file to your project root, rename it .env & replace values with your own values
  2. Add const nem = require("nemjs") where you need (file or function top level)
  3. Then use it like in these examples :
    • router.get("/", nem.checkAuth, UserCtrl.list)
    • nem.setAuth(guest.password, user, res)
    • if (nem.checkEmail(guest.email)) { ... }
    • if (nem.checkRange(guest.name)) { ... }
    • if (nem.checkPass(guest.password)) { ... }
    • const pass = nem.getPassword();
    • if (nem.checkUrl(item.url)) { ... }
    • nem.setImage(uploadImage, newImage);
    • nem.setThumbnail(uploadImage, newImage);
    • const mailer = nem.getMailer()
    • let message = nem.getMessage(req)

Tests

You can run unit tests with Jest :
NPM : npm test
Yarn : yarn test

2.1.3

4 months ago

2.1.2

4 months ago

2.1.1

5 months ago

2.1.0

5 months ago

2.0.0

5 months ago

1.6.2

8 months ago

1.6.1

11 months ago

1.6.0

11 months ago

1.5.0

11 months ago

1.4.1

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

0.10.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.9.0

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.1

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.1.3

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.1

1 year ago

0.4.2

1 year ago

0.1.2

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago