Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kt3k/now-deno-example
A demo application of now-deno and deno-postgres.
https://github.com/kt3k/now-deno-example
deno deno-postgres now-deno zeit-now
Last synced: 3 months ago
JSON representation
A demo application of now-deno and deno-postgres.
- Host: GitHub
- URL: https://github.com/kt3k/now-deno-example
- Owner: kt3k
- License: mit
- Created: 2020-02-13T16:10:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T14:14:37.000Z (over 4 years ago)
- Last Synced: 2024-10-03T12:44:44.764Z (4 months ago)
- Topics: deno, deno-postgres, now-deno, zeit-now
- Language: HTML
- Homepage: https://now-deno-example.kt3k.now.sh
- Size: 23.4 KB
- Stars: 30
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# now-deno-demo
Very simple BBS written in Deno, running on Zeit [Now][].
# Architecture
- Runs on Zeit [Now][], which means each endpoint runs as a serverless function.
- Written in [Deno][].
- Stores the data in Postgres DB.
- Single Page App, written in vanilla JS.# How to run this demo
You need postgres DB instance to run this demo. You can get a free instance from generous database hosting services such as AWS RDS, ElephantSQL, etc.
You need [Now][] and need to set the following information in `now secrets`
```
now secrets add pguser
now secrets add pgpassword
now secrets add pghost
now secrets add pgdatabase
now secrets add pgport
```You need to create a database in your postgres DB:
```sql
CREATE DATABASE bbs ENCODING 'UTF-8';
```You need to create the following table:
```sql
CREATE TABLE posts(
id SERIAL PRIMARY KEY,
name VARCHAR(255),
body TEXT,
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);
```I recommend you insert some of rows before starting:
```sql
INSERT INTO posts (name, body) VALUES ('alice', 'hi');
INSERT INTO posts (name, body) VALUES ('alice', 'anyone here?');
INSERT INTO posts (name, body) VALUES ('bob', 'hey');
INSERT INTO posts (name, body) VALUES ('bob', 'anyone?');
```Then hit the command `now` and that should run this app in your now account.
# License
MIT
[Now]: https://github.com/zeit/now
[Deno]: https://deno.land/