asad-mlbd / deno-api-starter-oak Goto Github PK
View Code? Open in Web Editor NEWDeno RESTful API project starter for oak framework
Deno RESTful API project starter for oak framework
I want to add middlewares which are equivalent to this in Express.js.
app.use('/user', userRoutes);
app.use('/post', postRoutes);
I tired a couple of things like exporting route object but this didn't work.
Right now I have two different route objects instantiated in two files. Which I know isn't the best.
So I was confused about how to achieve the same as above in Oak.
would love some clarifications. Thank you
I just tried running the app and got an error:
❯ deno run --allow-read --allow-net --unstable app.ts
Check file:///p/examples/deno-api-starter-oak/app.ts
error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
Type 'URL' is not assignable to type 'string'.
return new URL(url).pathname
~~~
at https://deno.land/[email protected]/path/win32.ts:911:18
TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
Type 'URL' is not assignable to type 'string'.
return new URL(url).pathname;
~~~
at https://deno.land/[email protected]/path/posix.ts:433:18
Found 2 errors.
I'm on the latest Deno version:
❯ deno --version
deno 1.3.1
v8 8.6.334
typescript 3.9.7
But it seems maybe that the Standard Library has changed?
I just tried the container and it still builds and runs.
Thanks for this @asad-mlbd , a few thoughts:
Any chance you could include an example of how to connect to MongoDB in a production friendly manner.
Noticed you're storing password in code, pretty sure that's bad security practice across the board? Shouldn't we be using something like docker secrets or chamber to handle this?
Also nervous about storing any type of secret in the codebase (jwt secrets included)
Shouldn't there be some sort of listener for the SIGKILL, SIGINT and similar events to handle db cleanup before shut-down?
Would be great if there's some sort of guidance/pattern for how to store data in a produciton-friendly manner, it seems to just mount to a directly on the host computer?
I think this is a good example and give complete how to work with oak in real project. but I think if move remove nessie from deps this project will more stable, we can use denSqlBuilder i stead.
and I'd like to update oak version to the katest.
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.