GithubHelp home page GithubHelp logo

nowapi's Introduction

NowAPI - When you need an API Now

CI npm version

Logo

Instantaneously create static HTTPS REST-like API endpoints.

When you don't want to go through all the hassle of setting up a REST API backend, NowAPI is the tool for you.

Use cases:

  • Tutorials
  • Simple static backend API endpoints
  • Learning REST APIs
  • Debugging client software

NowAPI has just been released and therefore subject to change. Your feedback is very welcome, please open an issue.

Overview

  1. Create a new virtual host:

    nowapi host new

    Output:

    ✔ Host created: amethyst-ptarmigan-98
  2. Add endpoints:

    For example, the IMDB movie top 3 as a JSON list of IMDB identifiers:

    nowapi endpoint set amethyst-ptarmigan-98 movies/top3 -b '["tt0111161", "tt0068646", "tt0468569"]'

    Add endpoints for details on each movie:

    nowapi endpoint set amethyst-ptarmigan-98 movie/tt0111161 -b '{"title": "The Shawshank Redemption"}'
    nowapi endpoint set amethyst-ptarmigan-98 movie/tt0068646 -b '{"title": "The Godfather"}'
    nowapi endpoint set amethyst-ptarmigan-98 movie/tt0468569 -b '{"title": "The Dark Night"}'
  3. List endpoints

    nowapi endpoint ls amethyst-ptarmigan-98

    Output:

    ✔ Loading endpoints
    Endpoints on host amethyst-ptarmigan-98:
    - movies/top3
      https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movies/top3
    - movie/tt0111161
      https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movie/tt0111161
    - movie/tt0068646
      https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movie/tt0068646
    - movie/tt0468569
      https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movie/tt0468569
  4. Use endpoints

    List movie top-3:

    curl https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movies/top3

    Output:

    ["tt0111161", "tt0068646", "tt0468569"]

    Get movie by identifier:

    curl https://nowapi.vercel.app/api/hosts/amethyst-ptarmigan-98/movie/tt0068646

    Output:

    {"title": "The Godfather"}

Installation

Homebrew

For macOS there is a Homebrew tap available:

brew tap robvanderleek/nowapi
brew install nowapi

NPX

Using npx, installation is not necessary. You can run NowAPI on a system with NodeJS 18 or higher from the command-line as follows:

npx nowapi-cli@latest -V

this should display the version number of the latest release.

Using npm NowAPI can be installed globally as follows:

npm install -g nowapi-cli

Platform binaries

Binaries for different platforms (Linux, Windows) are available on the latest release page.

Usage

Available commands and options can be listed by running the tool:

nowapi

It's necessary that you authorize NowAPI to interact with the NowAPI backend. This can be done by logging in as described below.

Login

nowapi login

Cope the code and open the web page.

Logout

nowapi logout

Hosts

Create a new virtual host

nowapi host new

Lists your virtual hosts

nowapi host ls

Delete new virtual host

nowapi host rm amethyst-ptarmigan-98

Endpoints

Create a new endpoint

nowapi endpoint set amethyst-ptarmigan-98 movie/tt0111161 -b '{"title": "The Shawshank Redemption"}'

Lists endpoints on a virtual host:

nowapi endpoint ls amethyst-ptarmigan-98

Delete endpoint on a virtual host:

nowapi endpoint rm amethyst-ptarmigan-98 movie/tt0111161

Feedback, suggestions and bug reports

Please create an issue here: https://github.com/robvanderleek/nowapi/issues

Contributing

If you have suggestions for how create-issue-branch could be improved, or want to report a bug, open an issue! All and any contributions are appreciated.

License

ISC © 2023 Rob van der Leek [email protected] (https://twitter.com/robvanderleek)

nowapi's People

Contributors

robvanderleek avatar semantic-release-bot avatar

Stargazers

Nick avatar

Watchers

 avatar  avatar

nowapi's Issues

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.