![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@adonisjs/http-server
Advanced tools
Decently fast HTTP server used by AdonisJS
This module is extracted from the AdonisJS framework to work as a standalone HTTP server. The performance of the server is on par with Fastify (not as fast as fastify though).
The benchmarking scheme is taken from the Fastify github repo.
Machine: Quad-Core Intel Core i7, 2.2GHz, 16GB RAM Method: autocannon -c 100 -d 40 -p 10 localhost:3000 * 2, taking the second average
Framework | Version | Router? | Requests/sec |
---|---|---|---|
Fastify | 2.0.0 | ✓ | 52709 |
AdonisJs | 1.5.4 | ✓ | 47791 |
You can run the same benchmarks by cloning the repo and then running the following command.
npm run benchmark
Since the program correctness and reliability is more important over micro optimizations. We pay penality on following fronts in comparison to Fastify.
(/api?foo[]=bar&foo[]=fuzz&foo[]=buzz )
, wherease fastify doesn't parse it by default for performance reasons. However, you can also define your own query string parser with fastify, but again, you will end up paying the same performance penality.You must be using the server inside a fully fledged AdonisJS application. Still, here's how you can start the standlone server.
npm i @adonisjs/http-server
import proxyaddr from 'proxy-addr'
import { createServer } from 'http'
import { Ioc } from '@adonisjs/fold'
import { Logger } from '@adonisjs/logger/build/standalone'
import { Profiler } from '@adonisjs/profiler/build/standalone'
import { Encryption } from '@adonisjs/encryption/build/standalone'
import { Server } from '@adonisjs/http-server'
const logger = new Logger({ enabled: true, level: 'trace', name: 'adonis' })
const profiler = new Profiler({ enabled: true })
const encryption = new Encryption('averylongrandom32charslongsecret')
const server = new Server(new Ioc(), logger, profiler, encryption, {
etag: false,
jsonpCallbackName: 'callback',
cookie: {},
subdomainOffset: 2,
generateRequestId: false,
secret: Math.random().toFixed(36).substring(2, 38),
trustProxy: proxyaddr.compile('loopback'),
allowMethodSpoofing: false,
})
server.router.get('/', async () => {
return { hello: 'world' }
})
server.optimize()
createServer(server.handle.bind(server)).listen(4000)
FAQs
AdonisJS HTTP server with support packed with Routing and Cookies
The npm package @adonisjs/http-server receives a total of 18,535 weekly downloads. As such, @adonisjs/http-server popularity was classified as popular.
We found that @adonisjs/http-server 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.