Giter VIP home page Giter VIP logo

deno-api-starter-oak's Issues

How can add middlewares to redirect to different Routes?

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

Error when running

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.

Great inspiration!

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?

need update deps and refactor

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.