Hello world: Zerops Edition
Tags: cloud, beginners, tooling, devops
Published: 2022-09-13 17:19:50

One of the most famous examples in programming is the iconic "Hello world". To follow this tradition, we use this very example to show all the steps needed for turning existing or new code into a working application powered by the new cloud application platform called [Zerops](https://contabo.com/en/zerops/).

## First things first: What is Zerops?

[Zerops](https://contabo.com/en/zerops/) is a recently introduced PaaS such as Heroku or Render. Like them, it aims to be a universal platform that builds, deploys, runs, and manages your apps for you, be it a tiny project in development or a large one in production.

With [Zerops](https://contabo.com/en/zerops/), you have a wide array of options when it comes to what you can run. You can opt for anything from a simple static web server to several runtimes for different programming languages backed up by various database management systems and other storage systems.

## Getting back to our “Hello world” example

To simplify matters we are omitting any extra steps such as connecting to GitHub and only focusing on the first steps. However, to increase the level a bit, we will take a look at two possible scenarios:

* Using a static web server
* Using a Node.js runtime

In both cases we assume that you already have a [Zerops](https://contabo.com/en/zerops/) account and an [installed zCLI](https://docs.contabozerops.com/documentation/cli/installation.html) (Zerops command line tool) with proper [authentication](https://docs.contabozerops.com/documentation/cli/authorization.html) set up. Please note that you could use any other runtime like for Golang or PHP.

## "Hello world" – the simplest way

* Create your `index.html` file with the following content:

```html
<!DOCTYPE html>
<html>
<body>
  <h1>Hello world from Zerops!</h1>
</body>
</html>
```

* Login to Zerops GUI, create a new `Hello world` project and add the `Static server` service with the chosen hostname `staticserver0`.

* Then simply deploy your file using the zCLI command:

```sh
zcli deploy "Hello world" staticserver0 index.html
```

* Enable Zerops subdomain access via `Public access & internal ports` on the `staticserver0` service and invoke the pre-generated URL in your browser.

Et voilà.

## "Hello world" – still a simple way using Node.js

* Create your `index.js` file with the following content:

```js
const http = require('http')

const requestHandler = (request, response) => {
  response.end('Hello world from Zerops!')
}

const server = http.createServer(requestHandler)
server.listen(3000);
```

* For [Zerops](https://contabo.com/en/zerops/) to know how to start the application, please create a `zerops.yml` configuration file next to it:

```yaml
nodejs0:
  build:
    build: []

  run:
    start: node index.js
```

* Login to Zerops GUI and create a new `Hello world (js)` project and add the `Node.js` service with the chosen hostname `nodejs0`.

* Then simply deploy your file using the zCLI command:

```sh
zcli deploy "Hello world (js)" nodejs0 index.js
```

* Enable Zerops subdomain access via `Public access & internal ports` on the `nodejs0` service and invoke the pre-generated URL in your browser.

All done! Congrats.

## Summing things up

We went through the basic steps of deploying an application to [Zerops](https://contabo.com/en/zerops/). You could see how simple it was. As you may have noticed from the sample `zerops.yml` files, on [Zerops](https://contabo.com/en/zerops/), you can take complete control of the building, deploying, and running of your code.

Coming up: more in-depth articles on how to make the most of [Zerops](https://contabo.com/en/zerops/).