prismyland / prismy Goto Github PK
View Code? Open in Web Editor NEW:rainbow: Simple and fast type safe server library.
Home Page: https://prismyland.github.io/prismy
:rainbow: Simple and fast type safe server library.
Home Page: https://prismyland.github.io/prismy
API routes of Next.js and Now.sh v2 are parsing body in advance. But our body selectors are trying to consume drained stream again so it is causing api routes fall into limbo.
npm run dev, npm run start, npx micro, npx prismy don't work and the readme doesn't actually say what to run the server locally.
The power of prismy can be aware when adopters are using it actually in VSCode.
I guess hosting some examples in Codesandbox should be enough!
To use parameter decorators, we're using class. But I think it is kind of annoying... I guess we could do like the below example.
myHandler.selectors = [Session()]
function myHandler(session: SessionState) {
}
export default prismy(myHandler)
The default error handler doesn't use console.log
. It makes debugging with prismy really difficult.
https://github.com/prismyland/prismy/blob/master/src/error.ts
silent
option. It should be false
by defaultconsole.error(...)
To use session, I think we need to introduce middleware. So I'm thinking that we would need middleware decorators, @before
and @after
.
@before
will be called right before run execute
method of a handler.
@after
will be called right after ...
ResponseObject<T>
is quite long and can make code a bit cumbersome expecially as it is very often wrapped with Promise
like Promise<ResponseObject<ApiResponseBody>>
.
It may be nice to have a shorter alias for ResponseObject
and maybe a something like AsyncResponse
for use with async handlers to help reduce code clutter.
We need redirectResult and redirect method for BaseHandler
I think I explained enough in the title...!
const numberSelector: Selector<number> = ...
const stringSelector: Selector<string> = ...
const handler = prismy([numberSelector, stringSelector], (numberValue, stringValue) => {
...
})
Typescrirpt should recognize the tuple, [number, string]
.
Typescript infers the type as (number | string )[]
It would be nice to show how prismy improve DX with GIF.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.