- Install Redis
- Install PostgreSQL (Optional)
- Install Redis Server
- Populate
.envfiles inpackages/webandpackages/api- If you used a custom port for Redis, make sure to modify
REDIS_URL, otherwise leave it as the default. - If you're running behind an NGINX reverse proxy, you'll want to make sure that you set
TRUST_PROXYtotrue. GITHUB_CLIENT_*are obtainable from making a Github OAuth developer application.- If running locally,
GITHUB_CALLBACK_URLis most likelyhttp://localhost:3000/api/auth/github/callback, but this can depend on your setup.
- If you used a custom port for Redis, make sure to modify
- Copy the
ormconfig.tsexample below to fill in yours. - You're set! You can now run the Oasis API locally!
import { ConnectionOptions } from 'typeorm';
import { joinRoot } from '@utils/common/rootPath';
// SQLite Example
const ormconfig: ConnectionOptions = {
type: 'sqlite',
database: './db.sqlite',
entities: [joinRoot('./entities/*.*')],
synchronize: true,
};
// PostgreSQL Example
const ormconfig: ConnectionOptions = {
type: "postgres",
username: "oasis",
password: "oasis",
uuidExtension: 'uuid-ossp',
migrations: [joinRoot('./migrations/*.*')],
entities: [joinRoot('./entities/*.*')],
synchronize: true,
};
export default ormconfig;- To run the API you will first need to build it by running
yarn build - To sync the schema run
yarn workspace @oasis/api typeorm:cli schema:sync(This may result in data loss). - If you want to run the api by itself you can run
yarn dev:api, if you would like to run the api with the website follow the instructions in the web quickstart guide
Any new code without tests will be denied
- To test the api you will need to have the api running as defined in the next step
- Start the api by running
yarn test:api:setupin root - Open a new terminal and run
yarn test:api:runto run the tests - To write new tests make a new file with the extension
.test.tsin the same directory as the code you want to test Tips - If you want to rerun tests but you didn't make any changes in your code you will need to rerun
yarn test:api:setup - It's recommended to use the
--watchflag when runningyarn test:api:setupas it will auto-detect changes and restart the testing server for you
# Generate a Migration command via the TypeORM Cli
$ yarn typeorm:generate_migration <name>
# Run the Migration
$ yarn typeorm:run_migrations