After 2 years of its first release, Deno v1.0 is finally here.
So, what is Deno anyway ?
Deno is a simple, modern and secure runtime...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for the simple proof-of-concept. How are you liking Deno so far? Do you see yourself using it in the future over Node?
Don't forget the import in app.ts
I like it, and I love the built in typescript support, do I see myself using it in the future over node? maybe in the future.
Thank you
Thanks for the article, it was really helpful.
Taking this as a starting point, I created a similar Deno project that stores the data in MongoDB.
Have a look at it and let me know what you think: github.com/hagopj13/deno-books-api
any, really ? Why then do you use TS, it would be better to write to JS right away, since there is no minute to go in and read which interface to use in request and response. For those who are also confused by this, here are the interface to import for these parameters:
Typing was not invented to simply ignore it, it was created to exclude a very large number of bugs at the time of writing before writing tests.
I totally agree with you and I am sorry for the bad practices in the code.
This was not supposed to be full fledged, secure, scalable app, it is just a simple demonstration on how you can create a simple deno REST, as simple as that.
Great article.
Might need to add those last few lines to the
controller.ts
file.Ah yes, Thank you.
Hey,
you also left out:
Thank you.
const getBook = ({ params, response }: { params: { isbn: string }; response: any }) => {
const book: IBook | undefined = searchBookByIsbn(params.isbn)
let indece:any;
indece=params.isbn
let index=indece-1
if (book) {
} else {
response.status = 404
response.body = { message:
Book not found.
}}
}
i made some changes, on get by id it was returning only the first register
Writing TS code is mandatory or optional in Deno?
optional
deno.land/manual/getting_started/t...
I'm a TS noob, but a Haskell intermediate. Is it really not possible to give types to request and response? Is there a library for that?
Great guide though!
Great article. @vincent Mancini
May i know which tool you're for API testing.
Thanks
I used "Servistate HTTP Editor & REST API Client" a chrome extension.
Thank you Vincent Mancini for example
I have tested this example ane add new small changes
here is the git repository link: github.com/parthkharecha/denojs-ap...
There is error in getBook method:
response.body = books[0]
must be:
response.body = book