easy-api.ts
TypeScript icon, indicating that this package has built-in type declarations

3.5.7 • Public • Published

EASY-API.TS

A powerful library to create your own API with ease.

img

Features

  • 🚀 Optimized and advanced codes and functions.
  • 📝 Easy to learn.
  • 📚 Constant updates.
  • 🔥 Image manipulation.

Install

npm i easy-api.ts

Check documentation here and join our support server.

Setup

const { API } = require('easy-api.ts');

const api = new API({
    dots: false,
    reverse: false
});

// Lets load our endpoints...
api.load('./routes')
console.log('Source loaded.') // API#load isn't async anymore.

api.connect({ port: 4500 }) // Now we're starting the API because the source is ready.

Route example

module.exports["route"] = {
    url: '/color',
    method: "GET",
    code: `
    $ignore[Check docs to see how does functions work.]
    $if[$or[$query[hex]==null;$isValidHex[$query[hex]]==false];
        $reply[
            $setCode[400]
            $setType[json]
            $setBody[{
                "error": "Invalid hex color code provided"
            }]
        ]
        $ignore[Now we're breaking it to stop executing the left code.]
        $break
    ]

    $createCanvas[
        $setDimentions[512;512]
        $color[$query[hex]]
        $drawRect[0;0;512;512]
    ]
    $reply[
        $setCode[200]
        $setType[canvas]
        $setBody[%default%]
    ]
    `
};
Click to read LICENSE

EASY-API.TS LICENSE

By using "easy-api.ts" you agree to the license terms and all conditions and consequences of not following these guidelines.

Declaration of rights

The complete code of "easy-api.ts" is copyrighted, and any unauthorized distribution of the code will be removed immediately.

Read-Only Code

The code is "read-only", this means that the code can only be used for reading purposes and cannot be modified, distributed, sublicensed or used to create derivative works.

Limitations of liability

We shall be excluded from any liability for damages or problems arising from the use of the code.

Intellectual identity protection

All intellectual property rights, including copyrights, patents, or other rights are and shall remain the exclusive property of Mid and any legal entity representing Mid.

Made with ❤️ by Moonlight Group

Dependencies (14)

Dev Dependencies (10)

Package Sidebar

Install

npm i easy-api.ts

Weekly Downloads

32

Version

3.5.7

License

Read licence in LICENSE.md

Unpacked Size

328 kB

Total Files

430

Last publish

Collaborators

  • midowo
  • asperion