![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-resty-app
Advanced tools
Elegant, performant and productive router for Openresty.
It's recommended to use npm to scaffold a lua-resty-router project.
npm create resty-app@latest -y
Then follow the instructions to complete the project.
fs
method to load routes from directorylocal Router = require('resty.router')
local router = Router:new()
local cnt = 0
local error_cnt = 0
-- Test events
-- for test purpose, assume the nginx is single-threaded
router:on('add', function(ctx)
cnt = cnt + 1
end)
router:on('error', function(ctx)
error_cnt = error_cnt + 1
end)
-- Test plugins
router:use(function(ctx)
ctx.cnt = cnt
ctx.error_cnt = error_cnt
end)
-- 1. Test static path
router:get("/hello", function()
return "Hello World"
end)
-- Test custom success status code
router:get("/hello-201", function()
return "Hello World", 201
end)
-- 2. Test JSON response
router:get("/json", function()
return { message = "success", code = 0 }
end)
-- 3. Test dynamic path parameters
router:get("/users/#id", function(ctx)
return {
id = ctx.params.id,
type = type(ctx.params.id)
}
end)
router:get("/users/:name", function(ctx)
return {
name = ctx.params.name,
type = type(ctx.params.name)
}
end)
-- 4. Test regex path
router:get([[/version/<ver>\d+\.\d+]], function(ctx)
return {
version = ctx.params.ver
}
end)
-- 5. Test wildcard
router:get("/files/*path", function(ctx)
return ctx.params.path
end)
-- 6. Test other HTTP methods
router:post("/accounts", function(ctx)
return { method = "POST" }
end)
router:put("/accounts/#id", function(ctx)
return { method = "PUT", id = ctx.params.id }
end)
-- 7. Test error handling
router:get("/error", function()
error("Test Error")
end)
-- Test custom error thrown by error()
router:get("/custom-error", function()
error({ code = 400, message = "Custom Error" })
end)
-- Test error in the form of return nil, err, code
router:get("/return-error", function()
return nil, "Parameter Error", 402
end)
-- Test handled error
router:get("/handled-error", function()
error { "handled error" }
end)
-- 8. Test status code
router:get("/404", function()
return nil, "Not Found", 404
end)
-- 9. Test HTML response
router:get("/html", function()
return "<h1>Hello HTML</h1>"
end)
-- Test HTML error
router:get("/html-error", function()
return nil, "<h1>Hello HTML error</h1>", 501
end)
-- Test HTML error thrown by error()
router:get("/html-error2", function()
error { "<h1>Hello HTML error2</h1>" }
end)
-- 10. Test function return
router:get("/func", function(ctx)
return function()
ngx.header.content_type = 'text/plain; charset=utf-8'
ngx.say("function called")
end
end)
-- 11. Check if events are executing properly
router:get("/add", function(ctx)
router:emit('add')
return ctx.cnt
end)
router:get("/events", function(ctx)
return ctx.cnt
end)
return router
(method) Router:new()
-> Router
create a router.
(method) Router:insert(path: string, handler: string|function, methods?: string|string[])
-> Router
insert a route.
---@alias Route {[1]:string, [2]:function|string, [3]?:string|string[]}
(method) Router:extend(routes: Route[])
-> Router
insert routes to a router.
(method) Router:match(path: string, method: string)
->
1. string|function
2. { [string]: string|number }?
match a http request
(method) Router:run()
-> nil
dispatch http request
(method) Router:fs(dir: string)
-> nil
load routes from directory (requires lfs
or syscall.lfs
module).
FAQs
high performance router
We found that create-resty-app 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
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.