1.0.7 • Published 2 years ago

express-eechy.js v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Eechy.js is a little library that allow you to transform your local libraries into a express api. It will take your libraries in the chosen folder, will get all the informations and do some tweeks to put on server route.

If it isn't clear, next.

Install it: npm i --save express-eechy.js Import it in your code:

const Eechy = require("express-eechy.js");

/!\ Eechy needs special model Yes. In fact, to work well, Eechy needs some data. Here is an example of Eechy library: libs/hello.js

// All libraries needed here...

module.exports.route = "/hello";
module.exports.run = async (name) => {
  console.log(`Hello ${name}`);
};
module.exports.params = ["name"];

/!\ run() function is asynchrone because otherwise libraries that work asynchronously won't work

If you will go to "/hello/world" then the server will print "Hello world".

So let use Eechy, where is an example:

const express = require("express");
const Eechy = require("express-eechy.js");

const app = express();

let myEechy = new Eechy(
  app,
  `${__dirname}/libs`,
  /* logs connections or not*/ true
);

myEechy.runAllLibs();

// ->  hello/:name was added
// ->  hello/world was called -> Hello world
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago