# 🛠️ Unlock the power of programmable API Gateways - customize your APIs with JavaScript Modules

Sometimes existing APIs are well thought out and designed, sometimes clients are flexibles and can adapt to the API responses.

And sometimes everything goes wrong ...

In such cases, it can be really helpful to be able to customize things in a central place to keep everyone happy.

🚀 That's why we're thrilled to introduce our new feature : **JavaScript Modules**

This new feature in **Cloud APIM Serverless** empowers developers to tailor their APIs to their exact specifications.

%[https://www.youtube.com/watch?v=4awrYEEIv_0] 

### **🤔 What are JavaScript Modules ?**

🔄 JavaScript Modules are reusable blocks of code written in JavaScript that can be easily integrated into your APIs.

These modules encapsulate specific functionality, such as data validation, transformation, or custom business logic, allowing you to enhance and extend the capabilities of your **APIs**.

### 💡 **Why integrating JavaScript Modules ?**

With JavaScript Modules, you have the freedom to customize every aspect of your API.

Whether you need to implement complex validation rules, transform data formats, or integrate with external services, **JavaScript Modules** provide a flexible and powerful solution.

By leveraging existing modules or creating your own, you can accelerate development and streamline maintenance, all while maintaining the scalability and reliability of your APIs.

### 🌟 **Key Benefits of JavaScript Modules**

**Flexibility**: JavaScript Modules enable you to adapt your APIs to meet the unique requirements of your applications and users.

**Reusability**: Reuse existing modules across multiple APIs to save time and effort in development.

**Scalability**: Scale your APIs effortlessly by leveraging modular architecture and distributed computing.

**Maintainability**: Simplify maintenance and updates by encapsulating logic in self-contained modules.

**Innovation** : Experiment with new features and functionality without disrupting existing APIs, fostering a culture of innovation and continuous improvement. 🚀

### **🏁 Getting Started with JavaScript Modules**

Getting started with JavaScript Modules in **Cloud APIM Serverless** is easy.

Simply browse our library of pre-built modules or create your own using your favorite JavaScript framework.

💻 Integrate modules seamlessly into your APIs using our intuitive interface, and start unlocking the full potential of customization today.

1. **Sign Up on Cloud APIM Serverless :**
    
    Before setting up a **Javascript Module**, ensure you have created a project on **Cloud APIM Serverless**.
    
    If you haven't created one yet, follow these steps:
    
    * Log in to your [Cloud APIM Serverless dashboard](https://console.cloud-apim.com/serverless/projects).
        
    * Click on *"New project"* and fill in your project name.
        
2. **Create your first Module :**
    
    * Navigate to the *" modules"* folder and create a new one.
        
        Your filename must ends by **'.js'**
        
        For example you can create a new file named **'first-module.js'**
        
    * Copy and paste the following code and edit it as you wish
        

```javascript
exports.on_backend_call = function (ctx) {
    return fetch(`https://jsonplaceholder.typicode.com/todos`)
    .then(response => response.json())
    .then(json => {
      return {
        status: 200,
        headers: {
          'Content-Type': 'application/json'
        },
        body_json: { 
          size: json.length, 
          data: json 
        }
      }
    })
};
```

3. **Link your module to your route :**
    
    * Select the *"openapi.json"* file
        
    * Choose the route you want to add the plugin or create a new route if you don't have one yet
        
    * In the ' plugins ' section let's choose **Javascript Module Plugin**
        
    * And now you just have to link the filename of your module
        
    
    ```json
    {
      "module": "/modules/first-module.js"
    }
    ```
    

### **🎉 Conclusion**

JavaScript Modules are a game-changer for API customization, offering unparalleled flexibility, reusability, and scalability.

With **Cloud APIM Serverless**, you have the tools you need to take your APIs to the next level and deliver exceptional experiences to your users.

Embrace the power of JavaScript Modules and transform the way you build APIs forever.

### **🚀 Get Started Now**

Ready to get started with **Cloud APIM Serverless** ?

[**Sign up now**](https://console.cloud-apim.com/serverless/projects) and take the first step towards secure and efficient **API management** !

### **📡 Stay Connected**

Follow our blog for the latest updates, tips, and best practices for **Cloud APIM Serverless** and **API management**.

### **🏢 About Cloud APIM**

[Cloud APIM](https://www.cloud-apim.com/) provides [cutting-edge, managed solutions for API management](https://console.cloud-apim.com/deployments), enabling businesses to leverage the full power of their APIs with ease and efficiency. Our commitment to innovation and excellence drives us to offer [the most advanced tools](https://console.cloud-apim.com/serverless/projects) and [services](https://console.cloud-apim.com/wasmo_deployments) to our customers, empowering them to achieve their digital transformation goals.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1717164600156/fe062e7d-f84c-4840-baac-e6af7a3cacf2.png align="center")
