Registry / web-framework / f2e-server

f2e-server

JSON →
library2.20.13jsnpmunverified

f2e-server 2 (v2.20.13) is a front-end development server with built-in support for Less compilation, Babel transpilation, live reload, and middleware-based plugin architecture. It provides CLI commands for starting a dev server (`f2e start`), building to output (`f2e build`), and generating config files (`f2e conf`). Unlike heavyweight dev servers like webpack-dev-server, f2e-server focuses on simplicity and runtime-build with proxy capabilities. It ships with TypeScript type definitions but is primarily configured via CommonJS config files. The project has been updated infrequently (last release likely 2021-2022) and may lack modern features like HMR or ESM native support. The server auto-detects ports starting from 2850 and supports HTTPS and custom hostnames. It is suitable for lightweight front-end projects that need a quick development environment with minimal configuration.

npm install f2e-server
INSTALL
IMPORT
SIG · F2E-SERVER
F
f2e-server
web-frameworkjavascriptv2.20.13
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.

f2e server (CLI)
npx f2e start
npm start
CLI is invoked via 'f2e' command, not npm scripts. Install globally or use npx.
Default config export
module.exports = { ... }
export default { ... }
Config is CommonJS, not ESM. Use module.exports.
Middleware function
(conf) => { return { onRoute, onSet, ... }; }
function middleware(conf) { } // missing return object
Middleware must return an object with lifecycle hooks. Forgetting the return object breaks server.
babel _rules
useBabel: { _rules: [ { only: ['file.js'], getModuleId: ... } ] }
useBabel: { _rules: [ { only: ['file.js'] } ] } // missing getModuleId
Each rule requires 'getModuleId' function. Without it, rule may be ignored.

Basic f2e-server configuration file with live reload, Less, Babel, and a middleware that proxies ES6 routes and compiles Markdown to HTML.

// .f2econfig.js const path = require('path'); module.exports = { livereload: true, useLess: { compress: false }, useBabel: { getModuleId: p => p.replace(/\\+/g, '/') }, gzip: true, range_size: 1024 * 1024, middlewares: [ (conf) => { return { onRoute(pathname, req, resp, memory) { if (pathname.match(/^es6/)) { const request = require('request'); request(pathname.replace('es6', 'http://es6.ruanyifeng.com')).pipe(resp); return false; } }, onSet(pathname, data, store) { if (pathname.match(/\.md$/)) { const res = require('marked')(data.toString()); store._set(pathname.replace(/\.md$/, '.html'), res); } }, buildWatcher(eventType, pathname, build) { console.log(new Date().toLocaleString(), eventType, pathname); } }; } ] }
f2e --version
Debug
Known issues
breakingf2e-server v2.x configuration is not compatible with v1.x. Middleware signature changed from (req, resp) to (conf).
fix
Update middleware to return an object and use conf parameter.
affects: >=2.0.0 <2.0.0
deprecatedThe 'request' package used in examples is deprecated and will not receive security updates.
fix
Replace with 'node-fetch' or 'axios' in your middleware.
affects: >=0.0.0
gotchaIf you omit 'return false' from onRoute, the request will continue to other middlewares and may cause double response.
fix
Always return false from onRoute if you are handling the response yourself.
affects: >=0.0.0
gotchaThe 'no_host' option is set to false by default. If you set a host in the config, requests that don't match the host header will be ignored.
fix
Set 'no_host: true' if you want to ignore host header and serve all requests.
affects: >=0.0.0
Errors
Common errors & fixes
Error: listen EADDRINUSE :::2850
Port 2850 already in use.
fix
Start with a specific port: f2e start -p 2851
Cannot find module 'marked'
Marked is not installed but used in middleware.
fix
Install marked: npm install marked --save-dev
TypeError: store._set is not a function
Using store._set outside of onSet hook; store is only available in onSet.
fix
Use store._set only inside onSet handler.
f2e: command not found
f2e-server is not installed globally or not in PATH.
fix
Install globally: npm install -g f2e-server
Upgrade
Version history
2.20.13latest on npm
Audit
Dependencies
requestoptionalUsed in default config example for proxy requests; deprecated but still usable.
markedoptionalUsed in example middleware for Markdown compilation; not a hard dependency but commonly used.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
f2e-server — npm install f2e-server · libregistry