New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bills

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bills

A quick implementation of routing and user validation

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Bills

Installation

$ npm install --save bills 

api.js

import fs from 'fs';
import express from 'express';
import bills from 'bills';

const app = express();
const router = JSON.parse(fs.readFileSync(__dirname + '/router.json').toString());

bills(app, router);

app.listen(3000)

router.json

"configure":{
    "connect": "mongodb://127.0.0.1:27017/your_database",
    "authenticate": true,
    "acl": {
      "default": "Visitor",
      "rol":["Admin", "Visitor"]
    },
    "jwt":{
      "secret": "my_word_secret",
      "day": "days_expire"
    }
  },
  "routes":[
    {
      "route": "TEST",
      "controller":{
        "name": "TEST",
        "method": [
          {
            "name": "GET",
            "feature": "allTest",
            "auth": true,
            "acl": ["Admin", "Visitor"]
          },
          {
            "name": "POST",
            "feature": "createTest",
            "auth": false,
            "acl": ["Admin"]
          },
          {
            "name": "PUT",
            "feature": "updateTest",
            "auth": false,
            "acl": ["Admin"]
          },
          {
            "name": "DELETE",
            "feature": "deleteTest",
            "auth": true,
            "acl": ["Admin"]
          }
        ]
      }
    }

Collection user: internal settings

user : {
  name  : String,
  user  : { type: String, required: true },
  pass  : String,
  email : Array,
  access: { type: Boolean, default: false },
  verify: { type: Boolean, default: false },
  rol   : { type: Array, enum: data.rol, default: data.default },
  date  : { type:Date, default: new Date() }
}

Accessing the user collection

let user = req.db.user;

Accessing user when authenticated.

if router.json has the attribute Authenticated = true

let user_id = req._user;

Project structure

├── api/
    ├── controllers/
    └── router.json

Keywords

FAQs

Package last updated on 09 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc