web-url-build Edge Function — Web Search
Web SearchBuild a URL from a base and optional path, query parameters, and hash fragment.
Edge function web-url-build Build a URL from a base and optional path, query parameters, and hash fragment.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.
npx aerostack add navin/web-url-build Use with AI Assistants
MCPConnect Claude, Cursor, or any MCP-compatible client — then call this function by slug
① Add MCP Server
Add this once — access all Aerostack functions from your AI tool.
{
"mcpServers": {
"aerostack": {
"url": "https://mcp.aerostack.dev",
"type": "http"
}
}
} ② Call this function
Ask your AI to use the call_function tool with this slug:
call_function({
slug: "web-url-build",
args: {
"base": "example_base",
"options": null
}
}) web-url-build — Build a URL from parts
Programmatically construct URLs from a base, path, query parameters (with array support), and hash fragment.
API
POST /api/web-url-build
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base |
string | Yes | — | Base URL |
options.path |
string | No | — | Path to append |
options.query |
object | No | — | Query params; arrays become repeated keys |
options.hash |
string | No | — | Hash fragment (with or without #) |
options.trailingSlash |
boolean | No | false | Append trailing slash |
Success response (200)
{
"success": true,
"data": {
"url": "https://example.com/search?q=hello&tag=a&tag=b#results",
"queryString": "?q=hello&tag=a&tag=b"
}
}
Error responses
| Code | HTTP | When |
|---|---|---|
INVALID_INPUT |
400 | Missing or invalid base |
INTERNAL_ERROR |
500 | Invalid URL or unexpected error |
Usage
cURL
curl -X POST "$FUNCTION_URL" \
-H "Content-Type: application/json" \
-d '{"base": "https://example.com", "options": {"path": "/search", "query": {"q": "hello", "tag": ["a","b"]}}}'
Direct import
import { webUrlBuild } from '@aerostack/functions/web-url-build';
const result = webUrlBuild({
base: 'https://api.example.com',
options: { path: '/v1/users', query: { page: 2, limit: 25 } },
});
console.log(result.url); // https://api.example.com/v1/users?page=2&limit=25
Use Cases
- Constructing paginated API URLs dynamically in server-side code
- Building share links with UTM tracking parameters
- Generating signed or parameterized webhook callback URLs
Metadata
Tags
Publisher
@navin verified
Build and publish your own functions
Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.
More Web Search Functions
Browse Web Search Functions →web-query-stringify
by @navin
Serialize a parameters object to a URL query string with support for arrays, encoding, and null skipping.
web-content-type-parse
by @navin
Parse a Content-Type header value into MIME type, subtype, charset, boundary, and convenience boolean flags.
web-headers-parse
by @navin
Parse a raw HTTP header block string or object into a structured lowercase-keyed object with content-type and authorization extraction.
web-ip-extract
by @navin
Extract the real client IP address from HTTP request headers, with proxy trust control and private IP detection.
web-query-parse
by @navin
Parse a URL query string into a typed object with support for arrays, number/boolean coercion, and bracket notation.
web-url-parse
by @navin
Parse a URL into structured parts including protocol, host, pathname, query object, and hash.
Frequently asked questions
What does the web-url-build function do? +
web-url-build is a serverless edge function for web-search automation written in aerostack. Deploy it to Cloudflare Workers via your Aerostack workspace.
How do I deploy the web-url-build function? +
Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/web-url-build ``` It will be live on Cloudflare Workers in seconds.
What runtime does web-url-build use? +
web-url-build runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.
Can I customise the web-url-build function? +
Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.