This is an example Hammer app. In order to figure out what Hammer should be like, we're first developing a simple app with the technology stack we want and seeing how it feels. Eventually, the things we learn here will be codified in the Hammer "architectural style" and a set of command line tools will help generate various things you need during a Hammer development cycle.
We use Yarn as our package manager. To get the dependencies installed, just do this in the root directory:
yarn install
You can generate the JavaScript client with:
yarn workspace api generate
The generated client will be placed in api/node_modules/@generated/photon
Create and migrate a local SQLite database:
cd api
yarn prisma2 lift up
cd ..
Prisma will offer a solution in the future, but in the meantime I've created
api/seed.js
which creates a few users, some documents and comments.
yarn babel-node api/seed.js
yarn start
Browse to localhost:8910
to see the web app. Lambda functions run on
localhost:8911
but are proxied to localhost:8910/.netlify/functions/*
.
Running prisma dev will watch for changes to your datamodel and will automatically apply migrations to your database and update the generated Photon (ORM) client.
cd api
yarn prisma2 dev
The data model is defined in: api/datamodel.prisma
. When you modify the data
model you generate a migaration with:
cd api
yarn prisma2 lift save
cd ..
To apply the migration run:
cd api
yarn prisma2 lift up
cd ..
This will create (or modify) a SQLite database in api/db/dev.db