Comments (2)
Based on the output of the command: grep -r methods pages/ > /tmp/methods.txt
, I believe the withRouteSpec
should have the methods:
get
post
put
patch
delete
getAndPost
postAndPut
postAndPatch
postAndDelete
We may want to exclude the postAndPut
because only one route uses it.
Also, it would be good to add some jsdoc
to explain why the methods like getAndPost
are helpful (I only understand why we do this after @seveibar explained it in a slack thread for someone else)
Furthermore, we should have a custom
method that accepts the method key inside the route_spec
to be more future-proof and handle edge cases.
from nextlove.
Nice analysis.
As an alternative to "custom", in typescript, it's possible to have a method that has properties like this:
interface myRouteSpec {
get: ({ }) => {};
({ methods: string[] }) => {}
}
// usage
myRouteSpec({ methods: ["GET"] })
myRouteSpec.get({ })
from nextlove.
Related Issues (20)
- Support Cloudflare DurableObjects (e.g. `req.cf.durableObject`)
- Support all array query serializations HOT 2
- Add command to generate Zod schemas for routes
- Generated route types not compatible with @typescript-eslint/ban-types
- Nextlove Edge Support MVP Steps HOT 1
- Add flag to disallow unknown object keys in response when `shouldValidateResponses` is enabled
- Add flag to only allow primitive types in Zod schemas
- Regression: cannot build with tsup starting with version 2.1.0 HOT 1
- move nextjs-middleware-wrappers and nextjs-exception-middleware to nextlove
- Validate array entries in query parameters
- Postman Collection Generation
- Support Custom Metadata in RouteSpec definitions for OpenAPI
- OpenAPI spec missing get when post is defined
- Cannot run middleware after auth middleware
- Nextlove should support `.optional()` on formData
- Support `multipart/form-data` (currently only `application/x-www-form-urlencoded` is supported)
- Parse .describe as markdown with yaml front matter HOT 3
- Generated OpenAPI spec is missing `api_key` from the security schemes
- approuter support HOT 1
- `api_key` is not included when using `key_or_session_or_token`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextlove.