erlang-server.README.mustache Maven / Gradle / Ivy
# OpenAPI server library for Erlang
## Overview
An Erlang server stub generated by [OpenAPI Generator](https://openapi-generator.tech) given an OpenAPI spec.
Dependencies: Erlang OTP/27 and rebar3. Also:
- [Cowboy](https://hex.pm/packages/cowboy)
- [Ranch](https://hex.pm/packages/ranch)
- [Jesse](https://hex.pm/packages/jesse)
## Prerequisites
## Getting started
Use erlang-server with rebar3
1, Create an application by using rebar3
$ rebar3 new app http_server
2, Generate erlang-server project using openapi-generator
https://github.com/OpenAPITools/openapi-generator#2---getting-started
3, Copy erlang-server file to http_server project, and don't forget the 'priv' folder.
4, Start in the http_server project:
1, Introduce the following line in the http_server_app:start(_Type, _Args) function
openapi_server:start(http_server, #{ip => {127,0,0,1}, port => 8080})
2, Compile your http_server project
$ rebar3 compile
3, Start erlang virtual machine
$ rebar3 shell
4, Start project
application:ensure_all_started(http_server).
To implement your own business logic, create a module called `http_server_logic` that implements the
behaviour `openapi_logic_handler`. Refer to `openapi_logic_handler` documentation for details.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy