Don't Know? CheckFirst. A tool to build eligibility checkers and calculators for Singapore Government policies
git clone git@github.com:opengovsg/checkfirst
cd checkfirst
npm ci
npm run dev
As defined in src/server/config
src/server/index.ts
for Express.jssrc/server/serverless/{api, static}.ts
for deployments into API Gateway + AWS Lambdaapi/
- API routing to authentication, CRUD operationsauth/
- Authentication layerbootstrap/
- Factory function to build the Express.js application for the backendchecker/
- CRUD operations layer to manage checkers created by the usermodels/
- Sequelize modelsutils/
- miscellaneous functionssrc/client/index.tsx
- mounts src/client/App.tsx
onto documentBy default SQLite DB is used. For other available environments refer to: src/server/database/config/config.ts
or edit the dialect for development environment to postgres
This may occur if the SQlite tables created is in the wrong format or required tables are not created
Add await sequelize.sync({ force:true })
to the src/server/bootstrap/index
file after await sequelize.authenticate()
. This will force all the tables in to be dropped and created again with the correct tables.
A potential long term fix for issues related to SQLite is to replace SQLite with a docker-compose environment for usage during development.
This section explains the steps required to perform remote database schema migrations using a bastion SSH instance.
ssh -L 5433:<DB_HOST>:5432 <SSH_TUNNEL_USER>@<SSH_TUNNEL_HOST> -i <PATH_TO_SSH_HOST_PEM_FILE>
NODE_ENV
environment variable to either staging
or production
DATABASE_URL
environment variable to the following postgres://<DB_USER>:<DB_PASS>@127.0.0.1:5433/<DB_NAME>
npx sequelize db:migrate
; perform the down-migration by running npx sequelize db:migrate:undo
SequelizeMeta
table in the database