Registry / web-framework / potato-framework

potato-framework

JSON →
library1.2.0jsnpmunverified

A simple HTTP framework for Node.js (version 1.2.0). Provides a minimal API for building web servers with routing, request handling, and middleware support. Designed for quick prototyping and small applications. Differentiates by focusing on simplicity and a single main export called Sweet Potato. Active development, but limited documentation and community adoption compared to Express.js. TypeScript types included.

npm install potato-framework
INSTALL
IMPORT
SIG · POTATO-FRAMEWORK
P
potato-framework
web-frameworkjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SweetPotato
import { SweetPotato } from 'potato-framework'
const SweetPotato = require('potato-framework')
ESM only since v1.2.0
default
import Potato from 'potato-framework'
import { default } from 'potato-framework'
Default import is the main class; named export is also available.
Request
import { Request } from 'potato-framework'
const { Request } = require('potato-framework')
TypeScript type for request objects
Response
import { Response } from 'potato-framework'
import { res } from 'potato-framework'
TypeScript type for response objects

Basic HTTP server with SweetPotato routing and built-in Node http module.

import { SweetPotato } from 'potato-framework'; import { createServer } from 'http'; const app = new SweetPotato(); app.get('/', (req, res) => { res.statusCode = 200; res.end('Hello Potato!'); }); const server = createServer(app.handle); server.listen(3000, () => { console.log('Server running on http://localhost:3000'); });
Debug
Known issues
gotchaSweetPotato's handle method must be passed directly, not wrapped in a function, to preserve `this` context.
fix
Use `app.handle.bind(app)` or wrap in arrow function: `(req, res) => app.handle(req, res)`
affects: >=1.0.0
deprecatedThe old `createServer` import path has been removed.
fix
Remove any import from 'potato-framework/createServer'
affects: >=1.0.0
breakingNode.js version 18.12.0 or higher required due to ESM support.
fix
Upgrade Node.js to v18.12.0+ or use a transpiler like Babel.
affects: >=1.0.0
gotchaRoute parameter extraction is case-sensitive and does not URL-decode automatically.
fix
Manually decode params with `decodeURIComponent()` if needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'path')
SweetPotato handle is called without proper binding; 'this' is undefined.
fix
Bind the handle method: `const server = createServer(app.handle.bind(app));`
SyntaxError: Unexpected token 'export'
Using CommonJS require() instead of ESM import.
fix
Use `import` statements and ensure `"type": "module"` in package.json
ERR_UNSUPPORTED_ESM_URL_SCHEME
Node.js version below 18.12.0 cannot resolve ESM imports.
fix
Upgrade Node.js to v18.12.0 or later.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
potato-framework — npm install potato-framework · libregistry