nelreina-node-utils

    1.0.0 • Public • Published

    nelreina-node-utils

    Library of handy Utils scripts for NodeJS / Most common use in my projects

    This package contains:

    • unirest
    • sqllize - some handy sequelize utility functions

    Unirest

    An abstraction of unirest module and promisify. Now you can use unirest with async/await

    API

    // Default to GET method
    unirest(url, options);

    Options

    options = {
      method: 'POST', // defaults to GET
      query: {}, // Object with query params
      body: {} // Object for POST/ PUT body
    };

    Example

    const { unirest } = require('nelreina-node-utils');
     
    unirest('https://jsonplaceholder.typicode.com/posts')
      .then(data => console.log(data))
      .catch(err => console.error(err));

    OR

    const { unirest } = require('nelreina-node-utils');
     
    (async () => {
      const data = await unirest('https://jsonplaceholder.typicode.com/posts');
      console.info(data);
    })();

    sqllize

    Pending docs...

    Install

    npm i nelreina-node-utils

    DownloadsWeekly Downloads

    7

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    6.02 kB

    Total Files

    16

    Last publish

    Collaborators

    • nelreina