@holofy/schema

1.0.8 • Public • Published

holofy-schema

About

MongoDB schema

  • @holofy/schema provides models for interacting with database objects.

Usage

Install the package:

npm install @holofy/schema --save-prod

Import as necessary:

const db = require('@holofy/schema');
const models = db(config.db);

To test on dev

Add .env to project root folder

DB_USER=
DB_PASSWORD=
DB_HOST=
DB_PORT= 
DB_NAME=

Add /sandbox/index.js to project root folder

// eslint-disable-next-line import/no-extraneous-dependencies
require('dotenv').config();

const db = require('../index');

const models = db({
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  database: process.env.DB_NAME,
});

models.Skill.findOne({}).then((res) => console.log(res));

On terminal

node sandbox/index.js

Please do not commit sandbox/* and .env

Publish New Package

  • Only once: In this repository: Add NPM_AUTH_TOKEN to GitLab -> Settings -> CI/CD -> Settings -> Variables
git add .
git commit
npm version [major | minor | patch]

Package Sidebar

Install

npm i @holofy/schema

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

49.6 kB

Total Files

33

Last publish

Collaborators

  • holofy