![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Super fast and minimalist web framework for building REST micro-services.
npm i restana --save
const service = require('restana')({});
const PetsModel = {
// ...
};
service.get('/pets/:id', (req, res) => {
res.send(PetsModel.findOne(req.params.id));
});
service.get('/pets', (req, res) => {
res.send(PetsModel.find());
});
service.delete('/pets/:id', (req, res) => {
res.send(PetsModel.destroy(req.params.id));
});
service.post('/pets/:name/:age', (req, res) => {
res.send(PetsModel.create(req.params));
});
service.patch('/pets/:id', function (req, res) {
res.send(this.update(req.params.id, JSON.stringify(req.body)));
}, PetsModel); // attaching this context
service.get('/version', function (req, res) {
res.body = { // optionally you can send the response data in the body property
version: '1.0.0'
}
res.send(); // 200 is the defacult response code
});
service.start(3000).then((server) => {});
// ...
service.close().then(()=> {});
Supported methods:
const methods = ['get', 'delete', 'put', 'patch', 'post', 'put', 'head', 'options'];
const service = require('restana')({});
// custom middleware to attach the X-Response-Time header to the response
service.use((req, res, next) => {
let now = new Date().getTime();
res.on('response', data => {
data.res.setHeader('X-Response-Time', new Date().getTime() - now);
});
return next();
});
// the /v1/welcome route handler
service.get('/v1/welcome', (req, res) => {
res.send('Hello World!');
});
// start the server
service.start();
Third party middlewares support:
Almost all middlewares using the function (req, res, next) signature format should work. With the consideration that they don't use any custom framework feature.
Examples :
Performance comparison for a basic Hello World! response in cluster mode with 4 processes:
ab -n 10000 -c 1000 http://localhost:3000/v1/welcome
Results:
FAQs
Super fast and minimalist web framework for building REST micro-services.
The npm package restana receives a total of 4,518 weekly downloads. As such, restana popularity was classified as popular.
We found that restana demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.