Giter Club home page Giter Club logo

razurefunc's Introduction

Azure Function with Swagger UI, written in R

This Dockerized R language API demo project provides an easy way to quickly deploy an API to either a local environment or the Azure cloud.

It utilizes R language for creating the API and allows for quick scaling and deployment to the cloud for maximum availability.

Additionally, it provides the flexibility of running the API locally, e.g. for local development and testing.

The project uses the popular Plumber framework to create a Swagger interface. This provides a robust layer of documentation to easily integrate with other applications and services. The included documentation offers an intuitive process for setting up and configuring the API and provides detailed information about the functionality of the API.

It is Linux-based Docker to create a containerized environment for the API. This allows for quick deployment to the cloud or local environment.

Linux-based Docker custom image created according the Microsoft documentation.

Start locally:

Start the API locally:

docker run -p 80:80 -it emergn/razurefunc:latest

Then go to http://my_host_i_started_container_on/__docs__/ to see the Swagger UI:

basic.png

Extend the basic image

To speed up the compilation process, you can inherit from the basic (precompiled) image and add your own code to it.

Dockerfile example:

FROM emergn/razurefunc:latest

# copy/overwrite file from the current directory into the [basic]container:
COPY services.R /application/services.R

Custom services.R file example:

library(plumber)

#* @apiTitle My Mega API: New image, based on BASIC one.
#* @apiDescription API REST services, written in R. This image was inherited from the BASE image!
#* @apiVersion 1.0


#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg="") {
  list(msg = paste0("The message is: '", msg, "'"))
}

Custom image files can be found in the /custom folder of the repository.

Place these 2 files (Dockerfile and services.R) in a separate folder, then build and run the container:

docker build -t mymegaapi:latest .

docker run -p 80:80 -it mymegaapi:latest

Go to http://my_host_i_started_container_on/__docs__/ to see the updated custom Swagger UI:

inherited.png

Start on Azure:

To start the same Docker image as Azure Function App: please, proceed to "Create supporting Azure resources for your function" section of this Microsoft documentation.

razurefunc's People

Contributors

divlv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.