npm.io
0.0.0 • Published 4 years ago

exp-util

Licence
MIT
Version
0.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
drawing

The official framework for express which automatically creates express paths, redirects and custom listen() function!

Getting Started

Install the NPM package in your console or shell

npm install exp-util@latest

It's coding time!

The example code is right here:

const { createRedirect, createPath, listen } = require('exp-util');
const express = require('express');
const app = express();
const port = 5000;

createRedirect({
  app: app, // You might be required to add 'app: app' in your path options since node-express dosen't actually use express in the module
  domain: 'example.com', // If blank, will throw an error
  slug: '', // If blank, the slug will be empty
  fwLinkSlug: '', // Changes the '/fwlink/?linkId=<any>' to '/<slug>/?linkId=<any>' (if blank, the follow link slug will turn into '/fwlink/?linkId=<any>' which is default)
  errorBodyMessage: '', // If blank, the error body message will turn into the default message
  linkId: 1 // If blank, will throw an error
});

createPath({
  app: app, // You might be required to add 'app: app' in your path options since node-express dosen't actually use express in the module
  path: '/', // If blank, will throw an error
  content: function(req, res) {
    res.send('Hello! This is a test with node-express!');
  } // If not a callback, will throw an error
});

listen(app, 5000); // Add the 'app' so the listen function still works! Amazing!

You can also use the listen() function if you want to have a [NODE-EXPRESS] custom built-in message!

Keywords