Creating an API with Daeploy

Or the shortest tutorial you’ll ever read about creating an API!

Creating an API

Creating an API with Daeploy is no harder than writing a regular python function. You simply decorate the functions you want to expose to the API with the entrypoint decorator, like this:

# from daeploy import service @service.entrypoint def hello(name: str) -> str: return f"Hello {name}" if __name__ == "__main__":

Deploying the API as a Service

This section requires you to have Docker installed on your machine, but the process is similar if you want to deploy to a remote machine. The first step is to start the Daeploy manager, which is available as a free docker image:

$ docker run -v /var/run/docker.sock:/var/run/docker.sock -p 80:80 -p 443:443 -d daeploy/manager:latest
$ daeploy login -host http://localhost
$ daeploy init --name hello_service
$ daeploy deploy hello 1.0.0 ./hello_service/



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Daeploy helps you to create APIs out of your existing #python code and deploy it as web services. Get started now!