Simple Nhost example app using Hasura.
- Create a project on nhost.io
- Clone this repo
- Edit config.js with the details from you project at nhost.io
npm installnpm start
- register page
- activate account page
- sign in page
- new password page
- forgot password
- upload file
- show file link (ex pdf)
- show file as image
- Get data using query
- Get data using subscriptions
- Mutate data
- Go to your Hasura console
- Click on the Data tab in the top menu
- Click on SQL in the left side menu
- Copy and paste the content from
db.sql(located here in the repo) in the Raw SQL textarea in the Hasura Console. - Check Track this
- Click Run!
- Click on the
todostable in the left side menu - Click on Permissions in the top menu
- Enter a new role
user - Click on the X under insert to start setting permissions for
insert- Under Row insert permissions
- Select Without any checks
- Under Column insert permissions
- Check
todo
- Check
- Under Column presets
- Select Column name
user_id - Select Select preset type
from session variable - Insert column-name
user-id(NOT underscore)
- Select Column name
- Click Save Permissions
- Under Row insert permissions
- Click on the X under select to start setting permissions for
select- Under Row select permissions
- Select With custom check
- Create the following check:
{"user_id":{"_eq":"X-Hasura-User-Id"}}
- Under Column select permissons
- Click the Toggle All button to select all columns
- Under Aggregation queries permissions
- Check Allow role User to make aggregation queries
- Click Save Permissions
- Under Row select permissions
- Click on the X under update to start setting permissions for
update- Under Row update permissions
- Select With same custom checks as select
- Under Column update permissions
- Check
todoanddone
- Check
- Click Save Permissions
- Under Row update permissions
- Click on the X under delete to start setting permissions for
delete- Under Row delete permissions
- Select With same custom checks as select, update
- Click Save Permissions
- Under Row delete permissions
- Click on the
filestable in the left side menu - Click on Permissions in the top menu
- Enter a new role
user - Click on the X under insert to start setting permissions for
insert- Under Row insert permissions
- Select Without any checks
- Under Column insert permissions
- Check
file_pathanddownloadable_url
- Check
- Under Column presets
- Select Column name
user_id - Select Select preset type
from session variable - Insert column-name
user-id(NOT underscore)
- Select Column name
- Click Save Permissions
- Under Row insert permissions
- Click on the X under select to start setting permissions for
select- Under Row select permissions
- Select With custom check
- Create the following check:
{"user_id":{"_eq":"X-Hasura-User-Id"}}
- Under Column select permissons
- Click the Toggle All button to select all columns
- Under Aggregation queries permissions
- Check Allow role User to make aggregation queries
- Click Save Permissions
- Under Row select permissions
- Click on the X under delete to start setting permissions for
delete- Under Row delete permissions
- Select With same custom checks as select, update
- Click Save Permissions
- Under Row delete permissions
- Click on the Data tab in the top menu
- Click Track All next to "Untracked foreign-key relations"
npm install
npm start
The app should appear in the browser.