2022-07-13
3198
#deno#postgresql
Diogo Souza
15453
Jul 13, 2022 ⋅ 11 min read

How to create a REST API with Deno and Postgres

Diogo Souza Brazilian dev. Creator of altaluna.com.br

Recent posts:

Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 ⋅ 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 ⋅ 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 ⋅ 7 min read
Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 ⋅ 10 min read
View all posts

11 Replies to "How to create a REST API with Deno and Postgres"

  1. > In order to prevent SQL injection — like every other major database framework — Deno allows us to pass parameters to our SQL queries as well.

    Am I missing something or is the `beerRepo.update()` function *full* of SQL injections? Example:

    query += ` SET name = ‘${beer.name}’` …

  2. deno run –allow-net –allow-env index.js
    error: No such file or directory (os error 2)

    I got this error, when i am trying run

  3. Compile file:///home/zire/dcode/postgr/index.js
    error: Uncaught AssertionError: Unexpected skip of the emit.
    at Object.assert ($deno$/util.ts:33:11)
    at compile ($deno$/compiler.ts:1170:7)
    at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
    at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
    at file:///home/zire/dcode/postgr/__anonymous__:1:1

  4. Hi guys, thanks very much for the comments. I’ve already addressed all of them both in the article and in the GitHub repo.

    Please, let me know if there’s still any problems to you. 🙂

  5. Great tutorial thanks! Hey would love to see a Typescript version of this project, anyone have an example of PostgreSQL + Deno + Typescript?

  6. Hey folks, I’ve had a go at converting this project to Typescript. Made some minor improvements/changes along the way. Classes seem to cause problems when instantiating the database, “possible undefined value” errors, so I removed them as they aren’t really needed.
    For any of you who are Typescript Savvy, I would love to get some feedback if I’ve gone about this the right way?
    https://github.com/fredlemieux/deno-postgresql-example

Leave a Reply