Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@jakecyr/simple-node-server
Advanced tools
npm install @jakecyr/simple-node-server
After installing installing the framework, create a new instance of Simple
and start creating your server:
// import simple framework
const Simple = require('@jakecyr/simple-node-server');
// create new simple server with logging
let app = new Simple(true);
app
.get('/', (req, res) => {
res.end('nothing here yet');
})
.get('/some-json', (req, res) => {
res.json({ task: 'Task 1' });
})
.listen(8080, '0.0.0.0', () => {
console.log('Listening');
});
Example:
function log(req, res, next) {
console.log('LOG VISIT', req.url);
next();
}
// add middleware to log page url visited to server console
app.get('/', log, (req, res) => {
res.end('Visit has been logged');
});
Parse query parameters as needed using the request
object in a handler function. Example:
app.get('/echo-name', (req, res) => {
const queryParams = req.query();
res.end(queryParams.name);
})
Parse a payload body as needed using the request
object in a handler function. Example:
app.post('/', async (req, res) => {
// wait for all payload data to parse
const payload = await req.body();
// echo back the payload to the client
res.json(payload);
})
FAQs
Simple and slim Node.js HTTP server
The npm package @jakecyr/simple-node-server receives a total of 1 weekly downloads. As such, @jakecyr/simple-node-server popularity was classified as not popular.
We found that @jakecyr/simple-node-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.