utils

Description
Utility functions to code faster.
Details

Classes


new ErrorResponse( message, statusCode )

Methods


<async, static> connectDB( uri )

Description
Connect to a Mongodb database.
Parameters
Name Type Description
uri string MongoDB connection string/URI
Examples
const { connectDB } = require("emfrest")

Usage

connectDB(MONGODB_URI)
Details

<static> handlePromiseRejections( server )

Description
Function to handle promise rejections.
Parameters
Name Type Description
server Http2Server Server instance returned by the Express app.listen() method.
Examples
const { handlePromiseRejections } = require("emfrest")

Usage

handlePromiseRejections(server)
Details