Skip to content

Napful is a Rust-based CLI tool designed for developers to easily store, manage, and execute HTTP requests.

License

Notifications You must be signed in to change notification settings

thiagokoster/napful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Napful

Napful is a command-line tool designed to help developers interact with HTTP APIs by running predefined requests.

Current features

  • List Requests: Easily list all requests saved in the requests folder.
  • Execute Requests: Run a specific request by name.
  • Environment variable support: Define environment variables in a .env file or as actual environment variables to customize your API requests on the fly.

Getting Started

To get started, you can clone the repository and compile the project using Cargo:

git clone https://github.com/thiagokoster/napful
cd napful
cargo build --release

Usage

Request File format

Requests are defined in .txt files within the requests folder. The file format follows:

# Request name
HTTP_METHOD(GET or POST) URL 
Header1: value
Header2: value

Body (if applicable)

Here is an example:

# Get posts
GET https://jsonplaceholder.typicode.com/posts

# Create post
POST https://jsonplaceholder.typicode.com/posts
Content-Type: application/json
Accept: application/json
   
{
  "title": "foo",
  "body": "bar"
}

Listing Requests

To list all the requests from the requests folder, use the following command:

napful list

Executing Requests

To execute a request, use:

napful run "Get posts"

Napful will omit response headers by default. They can be enabled --headers flag if necessary

napful run "Get posts" --headers

Environment Variables

Define environment variables in a .env file in your requests folder. The .env file should follow the format:

BASE_URL=https://api.example.com
API_KEY=your_api_key

You can also specify environment variables in your shell session, which will precede the .env file.

Variables can be used in the request file like so:

# Get posts
GET {{BASE_URL}}/posts

License

Napful is released under the MIT License. See the LICENSE file for more details.

About

Napful is a Rust-based CLI tool designed for developers to easily store, manage, and execute HTTP requests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages