Auto Detect Route
A VS Code extension that automatically discovers Express.js API routes from your Node.js codebase and lets you test them directly in the editor — like an embedded Postman, with zero manual setup.
Features
Automatic route discovery
- Scans your workspace for Express routes (
app.get, router.post, etc.)
- Resolves nested router prefixes across files:
app.use('/api', router) → /api/users
- Supports
GET, POST, PUT, PATCH, DELETE
- Handles CommonJS (
require) and ES Modules (import)
- Auto-refreshes when you save a file — new routes appear instantly
In-editor request panel
- Click any route in the sidebar → a request panel opens beside your code
- Fill in path params, query params, headers, and JSON body
- Hit Send — response appears with status, timing, size, and pretty-printed JSON
- Jump to the route definition with Go to Source
Environment variables (Postman-style)
- Define variables like
{{BASE_URL}}, {{AUTH_TOKEN}}, {{API_KEY}}
- Use them anywhere: URL, headers, body, query params
- Variables are resolved live in the URL preview
- Unresolved variables show an amber warning
- Mask sensitive values (tokens/passwords) with the 🔒 toggle
- Persisted globally across all workspaces and VS Code restarts
Persistent request state
- Headers, body, and auth tokens are saved per route
- Reopening a route restores exactly what you last typed
- Survives VS Code restarts
Getting started
Install
Install from the VS Code Marketplace or from a .vsix file:
Extensions panel → ··· → Install from VSIX…
Use
- Open any Node.js / Express project folder in VS Code
- Click the ◇ icon in the Activity Bar (left sidebar)
- Routes are detected automatically — click one to open the request panel
- Click ◇ Variables (toolbar icon) to add environment variables
Environment variables
Open the variable editor from:
- The ◇ button in the URL bar of any request panel, or
- The ◇ Variables icon in the Routes sidebar toolbar
Syntax
Use double curly braces anywhere in your request:
| Field |
Example |
| Base URL |
{{BASE_URL}}/api/users |
| Header value |
Bearer {{AUTH_TOKEN}} |
| Body |
{ "key": "{{API_KEY}}" } |
| Query param |
token={{ACCESS_TOKEN}} |
| Path param |
{{USER_ID}} |
Tips
- Disable a variable with its checkbox to temporarily exclude it without deleting it
- Mask a value with 🔒 to hide tokens from view while still using them in requests
- Variables resolve in real-time in the URL preview bar
Configuration
Open VS Code settings (Ctrl+,) and search for Auto Detect Route:
| Setting |
Default |
Description |
autoDetectRoute.baseUrl |
http://localhost:3000 |
Base URL used for all requests |
autoDetectRoute.groupBy |
file |
Group sidebar routes by file or method |
autoDetectRoute.exclude |
see below |
Glob patterns excluded from scanning |
autoDetectRoute.scanOnSave |
true |
Re-scan when a JS/TS file is saved |
Default excluded paths
**/node_modules/** **/dist/** **/build/**
**/out/** **/.git/** **/.env*
**/*.pem **/*.key **/*.p12
**/*.pfx **/*.crt **/.ssh/**
**/.aws/** **/secrets/**
Sensitive files (.env, private keys, certificates) are always excluded from scanning, even if not listed here.
Supported route patterns
// Direct method calls
app.get('/users', handler)
router.post('/login', handler)
// Nested routers with prefixes
app.use('/api', apiRouter) // → /api/...
router.use('/v1', v1Router) // → /api/v1/...
// Chained route handlers
router.route('/users').get(list).post(create)
// CommonJS
const users = require('./routes/users')
app.use('/users', users)
// ES Modules
import usersRouter from './routes/users'
app.use('/users', usersRouter)
// Inline require
app.use('/auth', require('./routes/auth'))
Security
- The extension never reads
.env, private keys, certificates, or credential files
- HTTP requests run in the VS Code extension host (Node.js), not the webview — no CORS issues
- Response bodies are capped at 10 MB to prevent memory exhaustion
- Only
http:// and https:// protocols are allowed in the base URL
- Header values are sanitised to prevent header injection
Keyboard shortcuts
| Action |
How |
| Refresh routes |
Click ↺ in the sidebar toolbar |
| Open request panel |
Click any route in the sidebar |
| Go to source |
Right-click a route → Go to Source |
| Manage variables |
Click ◇ in the sidebar toolbar or in the URL bar |
| Set base URL |
Ctrl+Shift+P → Auto Detect Route: Set Base URL |
Requirements
- VS Code 1.85 or later
- A workspace containing Node.js / Express.js source files
Limitations
- Static routes only — dynamically constructed paths (e.g.
`/${prefix}`) are not detected
- Framework support: Express.js only (Fastify, Koa, Hapi not yet supported)
- Maximum 500 JS/TS files scanned per workspace (configurable via
autoDetectRoute.exclude)
auto-detect-url
auto-detect-route
| |