Giter Club home page Giter Club logo

svelte-postgrest-tutorial-app's Introduction

what & why?

prequisites for dev env

  1. postgrest - install according to instructions.
    1. pgjwt - postgresql jwt extension for postgrest auth
  2. nvm - to easily swap node/npm versions. tested with node v13.11.0.

cloning

npx degit https://github.com/guyromm/svelte-postgrest-template svelte-postgrest-app

package.json dependencies

nvm use ; ./npm-init.sh

.env

use envs/local.tpl to create an envs/local .env shell file, and then expand/eval it using ./setenv.sh

   function freeport() {
	FROM=$1
	TO=$2
	HOWMANY=$3
	comm -23 \
	     <(seq "$FROM" "$TO" | sort) \
	     <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) \
	    | shuf | head -n "$HOWMANY"
   }
 export APPNAME=$(basename $(pwd))
 export DBNAME=$APPNAME
 export APPPORT=$(freeport 3000 4000 1)
 export POSTGRESTPORT=$[APPPORT+1]
 export SERVERPORT=$[APPPORT+2]
 export JWTSECRET=$(head /dev/urandom | tr -dc A-F0-9 | head -c 64 ; echo '')

 cp envs/local.tpl envs/local
 sed -i -E "s/APPPORTREPLACE/$APPPORT/g" envs/local
 sed -i -E "s/SERVERPORTREPLACE/$SERVERPORT/g" envs/local
 sed -i -E "s/POSTGRESTPORTREPLACE/$POSTGRESTPORT/g" envs/local
 sed -i -E "s/DBNAMEREPLACE/$DBNAME/g" envs/local
 sed -i -E "s/JWTSECRETREPLACE/$JWTSECRET/g" envs/local
 ./setenv.sh local

database initialization

source .env
echo 'DBNAME:'$DBNAME
./db_init.sh

launch

./tmux.sh

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.