UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

86 lines (70 loc) 2.47 kB
# EASY-API.TS A powerful library to create your own API with ease. ![img](https://i.imgur.com/2ksZSBy.jpg) ## Features - 🚀 Optimized and advanced codes and functions. - 📝 Easy to learn. - 📚 Constant updates. - 🔥 Image manipulation. ## Install ``` npm i easy-api.ts ``` Check documentation [here](https://eats.munlai.me/) and join our [support server](https://discord.gg/dKhuDRW8dB). ## Setup ```javascript 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 ```javascript 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%] ] ` }; ``` <details> <summary>Click to read LICENSE</summary> ## 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. </details> Made with ❤️ by **Moonlight Group**