![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 a REST API based on herbs entities (gotu) and usecases (buchu).
$ npm install herbs2rest
Use the method generateRoutes to generate api rest routes based on usecases.
herbs2rest works with express in version 4.x.
The method needs a list of controllers like the example below:
const controllerList = [
{
name: 'lists',
getAll: { usecase: require('../usecases/getLists'), controller: require('../controller') },
getById: { usecase: require('../usecases/getLists'), id: 'listId' },
post: { usecase: require('../usecases/createList') },
put: { usecase: require('../usecases/updateList') },
delete: { usecase: require('../usecases/deleteList') }
}
]
The name
field is the name of the route.
The id
field is the param of the route.
The controller
field is to replace the default controller.
The other fields refer to http methods using usecases (GetAll, GetById, Post, Put and Delete).
To create a custom controller, it is necessary to follow this pattern.
const controller = async (usecase, req, user, res, next) => {
// Implementation
}
Each method parameter has different data:
Generating and using new express routes:
const express = require('express')
const { generateRoutes } = require('herbs2rest')
const app = express()
const routes = new express.Router()
generateRoutes(controllerList, routes, true) // true = console info endpoints
app.use(routes)
All use cases must implement the authorization method and receive a user for authentication if using the default controller.
Example:
const { Ok, Err, usecase } = require('buchu')
const testUseCase = (injection) =>
usecase('Test UseCase', {
authorize: async (user) => {
if (user === 'admin')
return Ok()
else
return Err('Invalid user')
}
})
Additionally you can view a simple demo application of this library in todolist-on-herbs.
If you would like to help contribute to this repository, please see CONTRIBUTING
FAQs
Create a REST API based on HerbsJS
The npm package herbs2rest receives a total of 14 weekly downloads. As such, herbs2rest popularity was classified as not popular.
We found that herbs2rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.