

code from dependencies is possibly the most needlessly endemic problem confronting modern web application bundles, making them bigger and slower. We do not want to copy all the frontend files to our project by hand and committing them to our repository, we treat it just like any other library. As it’s a simple single-page application, the S3 bucket with the website hosting feature will be the easiest and cheapest solution.Ī custom Swagger UI website can be built with the swagger-ui-dist package. The next step is to build and deploy the Swagger UI website. Hosting Swagger UI website on S3 Building Swagger UI website "greeting": "Hello $input.params('name')!"Īfter deploying this stack, we should have a working API Gateway that we can test. Mock endpoints are easy to define with Serverless. We will start with a simple REST API with two mocked endpoints, one GET and one POST.
#Npm serverless webpack how to
It’s the kind of a process that everyone will forget to do on the nearest occasion.īut fear not, here is how to create a serverless, interactive, and always up-to-date Swagger UI for the API Gateway. Or even uploading it by-hand to a self-hosted Swagger UI page. I cannot imagine having to manually export the OAS file after every API deployment and send it by email or save on some Confluence page to provide it for other people. You don’t get a public URL to access the OAS.

And the de facto standard for sharing REST API docs is to create OpenAPI Specification ( OAS) and visualize it as an interactive website, for which the most popular engine is the Swagger UI.ĪPI Gateway allows generating such specification but provides no built-in solution to share it. When we build an API we often need to share it – with other developers, other teams, our clients, or publicly. It allows creating a serverless API for Lambda functions, existing HTTP services, and any other AWS service. Sharing REST API specificationĪmazon API Gateway is a basic building block for most serverless AWS applications.

#Npm serverless webpack full
If in a hurry, jump straight to the end, where you will find a link to the repository with full implementation. This is quite a long post with a step-by-step implementation guide. And, maybe the most important, it will be always up-to-date, with no work required after changes in the API Gateway endpoints. As a result, we will get a fully customizable website, with easy to implement access protection. This is why we need to do a few additional steps to get our beautiful documentation working. Instead, we can only get the file from the AWS Console, CLI, or SDK.

But we do not get a public URL to that specification file which we could use as a source for an interactive page like Swagger. With it, we can display our REST API as an interactive website.
