Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encore TS with Postgres + TypeORM (url-shortener) #177

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bits/postgres-typeorm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.encore
encore.gen.go
encore.gen.cue
/.encore
node_modules
/encore.gen
40 changes: 40 additions & 0 deletions bits/postgres-typeorm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Encore TS with Postgres + TypeORM

## Prerequisites

You should have an instance of Postgres database running.

## Running locally

```bash
npm install
encore run
```

While `encore run` is running, open <http://localhost:9400/> to view Encore's [local developer dashboard](https://encore.dev/docs/observability/dev-dash).

## Using the API

POST shorten any url

```bash
curl 'http://localhost:4000/url' -d '{"url":"https://google.com"}'
```

GET all urls in the database

```bash
curl 'http://localhost:4000/urls'
```

GET url by shortened id

```bash
curl 'http://localhost:4000/url/:id'
```

## Testing

```bash
encore test
```
6 changes: 6 additions & 0 deletions bits/postgres-typeorm/encore.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
// The app is not currently linked to the encore.dev platform.
// Use "encore app link" to link it.
"id": "",
"lang": "typescript",
}
Loading