GithubHelp home page GithubHelp logo

alpaca_elli_example's Introduction

alpaca_elli_example

A very simple Alpaca example application providing two HTTP endpoints with elli.

In preparing for the Alpaca v0.2.8 release this has turned up a number of basic usability issues for Alpaca:

  • no source annotations in the code generator output makes for a quite frustrating development and debugging experience as this means no stack traces! This will be pretty much top of my list for v0.2.9 and I might even delay v0.2.8 for it.
  • exhaustiveness checks when using pattern matching in function heads can fail when the checker tries to load a type from a module that has already been compiled. E.g. if elli_request.alp has already been built successfully, exhaustiveness checks of endpoint.alp will throw errors because the module for elli_request.alp doesn't appear to be available.
  • incorrect line numbers in some type errors.
  • some frustrating issues around multi-arity functions and type specifications for them e.g. there appear to be problems when handle/1 and handle/2 both exist but only a spec for handle/1 is available. I haven't dug into this too deeply yet so it may be more complicated or even rather simple.

This currently uses some pending changes to the rebar3 plugin from lepoetemaudit that allow a pre-built version of Alpaca to be used directly.

Build and Run

You will need a local build of Alpaca, basic steps:

  • clone the language repository
  • build a local untagged Alpaca distribution
  • set the ALPACA_ROOT environment variable to the location of your local Alpaca build

Here are the basic steps:

$ git clone https://github.com/alpaca-lang/alpaca.git
$ cd alpaca
$ rebar3 compile
$ bash ./make-release.sh
$ export ALPACA_ROOT=`pwd`/alpaca-unversioned_

Then you should be able to build and run this elli example:

$ cd $WHEREVER_YOU_CLONED_THIS_REPO
$ rebar3 clean
$ rebar3 release
$ ./_build/default/rel/alpaca_elli_example/bin/alpaca_elli_example foreground

Then:

➜  alpaca_elli_example git:(master) ✗ curl localhost:3000/test
Test endpoint.
➜  alpaca_elli_example git:(master) ✗ curl localhost:3000/hello/world
Hello, world
➜  alpaca_elli_example git:(master) ✗ curl localhost:3000/hello/Wat
Hello, Wat
➜  alpaca_elli_example git:(master) ✗ curl -X PUT localhost:3000/hello/Wat
Not found
➜  alpaca_elli_example git:(master) ✗

alpaca_elli_example's People

Contributors

j14159 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.