![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.
Create streaming, rate-limited APIs with ease
npm install api-stream --save
Creating a streaming, rate-limited, caching Wikipedia search API:
var https = require('https'),
apiStream = require('api-stream'),
apiURL = 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=';
module.exports = apiStream.createApi(constructorOptions => (query, done) => {
https.get(apiURL + encodeURIComponent(query), res => {
var response = '';
if(res.statusCode !== 200) {
done({status: res.statusCode}, null);
return;
}
res.on('data', d => response += d);
res.on('end', () => done(null, JSON.parse(response)));
});
});
Using the created API:
var WikiSearchAPI = require('./wikistream.js');
// create an API stream which runs with a maximum of
// 10 queries per second, and caches results in wiki.db
var wikiStream = new WikiSearchAPI({
queriesPerSecond: 10,
cacheFile: 'wiki.db'
});
wikiStream.on('data', d => console.log(d));
wikiStream.on('end', () => console.log('Done.'));
wikiStream.write('Hamburg');
wikiStream.write('Ubilabs');
wikiStream.write('NodeJS');
wikiStream.end();
apiStream.createApi(initialiseEndpoint, endpointDefaultOptions = {})
<Function>
Endpoint initialisation function<Object>
Default options for the constructor of the created classThe endpoint initialisation function must take an options
object as parameter. The options can be user-defined upon initialisation of the generated API class. The endpoint initialisation function should return an endpoint function. The endpoint function is called for every item written to the generated API stream. It is passed two parameters:
?
. The query written to the stream, after it has been passed through the accessor
function.Function
. A callback function which must be called once, after the API query is completed. Pass an error as first parameter to indiciate failure, or null
to indicate success. Pass the API response as second parameter.The constructor of created stream class accepts an options object.
The options object is used to define some behaviour (e.g. queriesPerSecond, caching), and is then passed on as parameter to initialiseEndpoint
.
All default values may be overriden by re-defining the value in endpointDefaultOptions
.
By default, the created stream classes support the following options:
Number
, default: 35
. Defines the maximum number of requests per second. Must be at least 1
.String
, default: null
. Defines the name of the cache file to be used. The cache is disable if no name has been defined.Function
, default: data => data
. Items written to the stream will be passed through options.accessor
before being passed as query to queryEndpoint
.Object
, default: {current: 0}
. A statistics object which will be attached to each result. The options.stats.current
property is increment on each query.FAQs
Easily create streaming, rate-limited APIs
The npm package api-stream receives a total of 0 weekly downloads. As such, api-stream popularity was classified as not popular.
We found that api-stream 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
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.