You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enabling CORS in a REST API is very important, there is an example created by @spytheman in vweb/cors app.add_header("Access-Control-Allow-Origin", "*")
but in x.vweb it doesn't work, and I think it could be a better and faster way to configure CORS, instead of adding a preflight function on @['/:path...'; options]
Why not add a Context function that takes the CORS config and could be added to before_request if we want the same config to all endpoints, or to be added to some endpoints as an argument...
Use Case
Usually in other frameworks, I import cors library and set the cors options in a variable then app.use(corsOptions)
Proposed Solution
a Context function that takes Origin, Methods etc as arguments... ctx.set_cors("*", "GET, POST, PUT, DELETE")
Other Information
No response
Acknowledgements
I may be able to implement this feature request
This feature might incur a breaking change
Version used
x.vweb 0.4.4
Environment details (OS name and version, etc.)
V full version: V 0.4.4 8e47c21.804a7bd
OS: linux, "ArcoLinux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 7840HS with Radeon 780M Graphics
Git version: git version 2.43.0
Git vroot status: weekly.2024.05-2-g804a7bdd (10 commit(s) behind V master)
.git/config present: true
CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered:
Describe the feature
Enabling CORS in a REST API is very important, there is an example created by @spytheman in vweb/cors
app.add_header("Access-Control-Allow-Origin", "*")
but in x.vweb it doesn't work, and I think it could be a better and faster way to configure CORS, instead of adding a preflight function on @['/:path...'; options]
Why not add a Context function that takes the CORS config and could be added to before_request if we want the same config to all endpoints, or to be added to some endpoints as an argument...
Use Case
Usually in other frameworks, I import cors library and set the cors options in a variable then app.use(corsOptions)
Proposed Solution
a Context function that takes Origin, Methods etc as arguments...
ctx.set_cors("*", "GET, POST, PUT, DELETE")
Other Information
No response
Acknowledgements
Version used
x.vweb 0.4.4
Environment details (OS name and version, etc.)
V full version: V 0.4.4 8e47c21.804a7bd
OS: linux, "ArcoLinux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 7840HS with Radeon 780M Graphics
Git version: git version 2.43.0
Git vroot status: weekly.2024.05-2-g804a7bdd (10 commit(s) behind V master)
.git/config present: true
CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: