bunsvr / app Goto Github PK
View Code? Open in Web Editor NEWBuild high-performance and scalable web apps
Build high-performance and scalable web apps
this is fine no error lint. but not working, It will throw error: Cannot find module "@stricjs/app/lib/send" from xxx
at console
import { text } from '@stricjs/app/lib/send';
this is fine but it has error. and its working xD wont throw error at console. but gonna throw at lint error swigly redline.
Cannot find module '@stricjs/app/send' or its corresponding type declarations.ts(2307)
import { text } from '@stricjs/app/send';
please fix typescript types xD me no like errors even tho it works still in editor its red line xD because i think u move the .d.ts on library lib instead of root.
I tried out Server-Sent Events in Stric, but I keep running into an issue when I call my endpoint.
Here is the stacktrace:
1 | function anonymous(pull,abort,cancel,o
2 | ) {
3 | return c=>new Response(new ReadableStream({type:'direct',pull:_=>{while(!c.signal.aborted)pull(_,c);abort(_,c)},cancel:_=>{cancel(_,c)}}),o)
^
TypeError: undefined is not an object (evaluating 'c.signal.aborted')
at pull (:3:136)
at readDirectStream (:1:21)
GET - /sse failed
Here is my main.routes.ts
:
import { routes } from '@stricjs/app';
import { events } from '@stricjs/app/stream';
export default routes()
.get('/sse', (ctx) => {
let interval: Timer | undefined;
const evs = events((controller, ctx) => {
interval = setInterval(() => {
controller.write('hello');
}, 1000);
});
evs.abort((controller, ctx) => {
console.log('abort');
clearInterval(interval);
});
evs.cancel((controller, ctx) => {
console.log('cancel');
clearInterval(interval);
});
return evs.send()(ctx);
})
Not sure what signal.aborted
is supposed to be on the, what I assume is, the context that is being passed in to the function returned from evs.send()
.
Let me know if I can help out in any way or if you have any other questions.
Thank you!
This code in file index.ts
import { init } from '@stricjs/app';
init({
routes: ['./src'],
fallback: function (ctx) {
return new Response('404 - NotFound', { status: 404 })
}
});
and this code in file src/index.routes.ts
import { routes } from "@stricjs/app";
export default routes()
.post('/hello', () => new Response('Hello POST'))
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.