You need to install Elixir. We recommand using asdf.
Check their documentation on how to install it, then run asdf install
from
root captain-fact-api
folder.
Create / launch a postgres instance on your local machine. If you have docker installed, you can use the pre-seed postgres docker image:
docker run -d --name cf_dev_db -p 5432:5432 captainfact/dev-db:latest
mix deps.get
--> Get dependenciesmix ecto.migrate
--> Migrate DBiex -S mix
--> Start project
Following services will be started:
- localhost:4000 - REST API
- localhost:4001 - REST API (https)
- localhost:4002 - GraphQL API
- localhost:4003 - GraphQL API (https)
- localhost:4004 - Atom feed
You can also see all the mail sent by going to http://localhost:4000/_dev/mail
mix test
--> Run testsmix test.watch
--> Run tests watchermix format
--> Format codemix ecto.gen.migration [migration_name]
--> Generate migration
This application is organized as an umbrella project which allows us to divide CaptainFact API into small apps.
.
βββ apps
β βββ cf => Core functions as a library. **Not deployed**
β βββ cf_atom_feed => Atom feed.
β βββ cf_graphql => GraphQL API (public).
β βββ cf_jobs => Jobs.
β βββ cf_opengraph => An app that generate opengraph tags.
β βββ cf_rest_api => REST/WS API (private).
β βββ db => DB repository and schemas **Not deployed**
β βββ lib
β β βββ db
β β βββ db_schema => Contains all the schemas (Video, Speaker, Comment...etc)
β β βββ db_type => Special types (SpeakerPicture...etc)
β β βββ db_utils => Some utils functions
β βββ priv
β βββ repo/migrations => All DB migrations files
βββ README.md => You're reading it right now. Are you?
βββ rel => Release configs & tools
β βββ commands => Commands that will be available to run on the release (seed DB...etc)
β βββ hooks => Some hooks for automatically run commands when release run.
β βββ runtime_config => Runtime configurations for all apps.
β βββ config.exs => Releases configuration.