![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A port of http4k: a lightweight toolkit to allow in memory functional testing and to simplify working with HTTP.
If you wrote a thin API layer that translated the wire representation of HTTP into a few domain objects: Request, Response and Routing, and translated back again, you essentially wind up with the whole of http4js.
This seemingly basic idea is the beauty and power of http4js and the SaaF (Server as a Function) concept.
We translate a wire request into a Request object. Our server is a function from Request -> Response, we translate a Response to a wire response.
We write all our routing logic with our Routing domain object.
Hence we can run server in memory and test our entire stack and therefore the only added benefit of functional testing is to test the translation between wire and domain.
We inject all of our dependencies to our Server so testing using fakes is easy peasy. We can even write simple fakes of external dependencies and spin them up in memory.
tsc index.ts --target es5; node index.js
npm install --save
npm test
In order to run tests in idea/webstorm, you may need to:
npm install @types/mocha --save-dev
npm install ts-node --save-dev
npm install typescript --save-dev
import {Request} from "./src/main/core/Request";
import {HttpHandler} from "./src/main/core/HttpMessage";
import {routes} from "./src/main/core/RoutingHttpHandler";
import {Response} from "./src/main/core/Response";
import {HttpClient} from "./src/main/core/Client";
import {Body} from "./src/main/core/Body";
import {Uri} from "./src/main/core/Uri";
&
let handler = (req: Request) => {
let bodyString = `<h1>${req.method} to ${req.uri.href} with headers ${Object.keys(req.headers)}</h1>`;
return new Response(200, new Body(Buffer.from(bodyString)))
};
&
let headerFilter = (handler: HttpHandler) => {
return (req: Request) => {
return handler(req.setHeader("filter", "1"));
}
};
&
let moreRoutes = routes("/bob/{id}", "POST", (req) => {
return new Response(201, new Body("created a " + req.path))
});
&
routes("/path", "GET", handler)
.withHandler("/tom", "GET", handler)
.withRoutes(moreRoutes)
.withFilter(headerFilter)
.asServer(3000).start();
&
let getRequest = new Request("GET", Uri.of("http://localhost:3000/path/tom")).setHeader("tom", "rules");
&
let postRequest = new Request("GET", Uri.of("http://localhost:3000/path/tom")).setHeader("tom", "rules");
&
let client = HttpClient;
&
client(getRequest).then(succ => {
console.log("body string");
console.log(succ.body.bodyString());
console.log("headers");
console.log(succ.headers);
});
&
client(postRequest).then(succ => {
console.log("body string");
console.log(succ.body.bodyString());
console.log("headers");
console.log(succ.headers);
});
FAQs
A lightweight HTTP toolkit
The npm package http4js receives a total of 703 weekly downloads. As such, http4js popularity was classified as not popular.
We found that http4js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.