{"id":37205925,"url":"https://github.com/agupta666/elf","last_synced_at":"2026-01-14T23:43:12.976Z","repository":{"id":57525712,"uuid":"67247977","full_name":"agupta666/elf","owner":"agupta666","description":"HTTP server console :alien:","archived":false,"fork":false,"pushed_at":"2017-09-15T17:11:12.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T14:21:43.362Z","etag":null,"topics":["cli","http","http-api","http-mocking","http-server","interactive","json","service"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agupta666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-02T19:05:32.000Z","updated_at":"2024-06-20T14:21:43.364Z","dependencies_parsed_at":"2022-08-28T22:12:49.064Z","dependency_job_id":null,"html_url":"https://github.com/agupta666/elf","commit_stats":null,"previous_names":["agupta666/hash"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agupta666/elf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agupta666%2Felf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agupta666%2Felf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agupta666%2Felf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agupta666%2Felf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agupta666","download_url":"https://codeload.github.com/agupta666/elf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agupta666%2Felf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28439527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","http","http-api","http-mocking","http-server","interactive","json","service"],"created_at":"2026-01-14T23:43:12.460Z","updated_at":"2026-01-14T23:43:12.954Z","avatar_url":"https://github.com/agupta666.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/agupta666/elf.svg?branch=master)](https://travis-ci.org/agupta666/elf)\n[![Go Report Card](https://goreportcard.com/badge/github.com/agupta666/elf)](https://goreportcard.com/report/github.com/agupta666/elf)\n# Elf\n\nElf is an HTTP server which lets you interact with it through a command-line interface. It gives you a quick and easy interface to set up `routes` and attach `actions` to them.\n\nElf provides a large collection of built-in actions, which can be added and configured with a fair amount of ease, from the command-line interface. And all of these can be achieved without writing a bit of code. The elf was primarily created for the purpose of quickly mocking HTTP based services without using going through the hassle of installing another scripting language.\n\nElf is a single executable that you can download and put in your path, to get started right away. Elf attempts to make it trivially easy to setup HTTP endpoints. The `elf` CLI provides a bash like command-line editing interface and intelligent `TAB` completions, that lets you manage routes and actions with ease.\n\n\u003e **NOTE:** Elf is an experiment and is expected to be used for testing purposes only. Elf is not intended for production usage.\n\n## Install\n\n```\n$ go get github.com/agupta666/elf\n```\n\n## Quickstart\n\nTo start `elf`, fire the below command in a terminal. This starts Elf in interactive mode and drops\nyou to a prompt. Now you are ready to interact with the HTTP server listening on port 8080.\n\n```\n$ elf\nstarting default http endpoint 0.0.0.0:8080\nelf\u003e  \n\n```\nHitting the `TAB` key will display a list of commands supported by Elf. See the command reference section for\ndetails of the individual commands.\n\n## Routes and Actions\n\nElf lets you set up routes using the `route` command, which is of the form\n\n```\nelf\u003e route \u003c/some/path\u003e \u003caction\u003e\n```\nThus when a request is received that matches the given path, elf executes the `action` attached to it.\n\nFor example, the below route command will attach a built-in action [which will respond with the contents of the `data.txt` file] for a request matching the given path.\n\n```\nelf\u003e route /data @data.txt\n```\nThus sending a HTTP request using curl, displays the response shown below.\n\n```\n$ curl -i http://localhost:8080/data\nHTTP/1.1 200 OK\nContent-Type: text/plain; charset=utf-8\nDate: Mon, 04 Sep 2017 18:40:49 GMT\nTransfer-Encoding: chunked\n\ncontents of data.txt ...\n```\n\n## Built-in actions\n| Action     | Syntax                                   | Meaning                                                               |\n|------------|------------------------------------------|-----------------------------------------------------------------------|\n|  File      |  @\u003cfile-path\u003e                            | Responds with the contents of the given file                          |\n|  Shell     |  !\u003cshell-command\u003e                        | Responds with the output of the shell command                         |\n|  Markdown  |  #\u003cpath-to-markdown-file\u003e                | Responds with HTML representation of the given markdown file          |\n|  Redirect  |  ^\u003csome-url\u003e                             | Redirects to the given URL                                            |\n|  Forward   |  %\u003csome-url\u003e                             | Forwards the request to the given URL                                 |\n|  Data      |  data[options...]                        | Responds with random data                                             |\n|  Image     |  image[options...]                       | Responds with image data                                              |\n|  JSON      |  json[data-set]                          | Responds with JSON representation of a data set                       |\n|  Upload    |  upload[options]                         | Saves the uploaded file to a specified folder                         |\n|  Directory |  dir[options]                            | Serves files from the specified folder                                |\n|  Dump      |  dump[options]                           | Dumps the incoming HTTP request to a specified folder                 |\n|  Echo      |  echo[options]                           | Echoes back the incoming HTTP request                                 |\n\n\n## Action Reference\n\n### File\nThis is a built-in action that serves a static file. A static file can be specified with its absolute path with `@` as a prefix.\n\nE.g.:\n\n```\nroute /static @/var/www/index.html\n```\n\n### Shell Commands\nThis is a builtin action which executes the specified command on the local server and responds with the output. This action can\nbe specified by prefixing `!` before the shell command\n\n#### Examples\n\n\n```\nelf\u003e route /clip !pbpaste\n```\n\n```\nelf\u003e route /go !\"w3m -dump https://golang.org/doc/effective_go.html\"\n```\n\n### Generate arbitrary data\n```\nelf\u003e route /download \"data[9024,.bin]\"\nelf\u003e route /download \"data[9024,.bin,trivia]\"\n```\n\n### Generate Images\n\n`route /some/route \"image[width, height, color, format, name]\"`\n\n```\nelf\u003e route /download \"image[400,400]\"\nelf\u003e route /download \"image[400,400, #E32171]\"\nelf\u003e route /download \"image[400,400, #E32171, .png]\"\nelf\u003e route /download \"image[400,400, #E32171, .png, gopher]\"\n```\n\n### Respond with the JSON representation of a Key-Value set\n\nCreate a new Key-Value set\n\n```\nelf\u003e kvset dset a:1 b:2 c:3\n```\n\nnow add a route with a JSON action\n\n```\nelf\u003e route /api json[dset]\n```\n\n\n### Upload files\nadd a route with upload action\n\n```\nelf\u003e route /save \"upload[/path/to/some/folder, picture]\"\n```\n\nupload file with curl\n\n```\n$ curl --form picture=@somefile.png http://localhost:8080/save\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagupta666%2Felf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagupta666%2Felf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagupta666%2Felf/lists"}