(Français)
The DMARC Report API is exclusively focused on serving data, rather than HTML. It is a GraphQL API, chosen because of its composability, legibility and for the way it enables both security and security automation. It is built with the Express webserver using the apollo-server-express middleware, and follows the Relay specifications for pagination.
npm installIn accordance with the 12Factor app philosophy, the server draws it's config from the environment. It does based on a .env file that should exist in the root of the API folder which can be created with the following command, obviously modifying the test values shown to suit your setup.
cat <<'EOF' > test.env
AZURE_CONN_STRING=connection string
DATABASE=database
SUMMARIES_CONTAINER=summaries
API_CONTAINER=api
SUPER_ADMIN_TOKEN=sa-token
DMARC_REPORT_API_SECRET=test-secret
TOKEN_HASH=test-hash
DMARC_REPORT_API_TOKEN=test-token
DEPTH_LIMIT=2
COST_LIMIT=100
SCALAR_COST=1
OBJECT_COST=1
LIST_FACTOR=1
EOFWith that defined you can start the server with these commands.
# Run the server
npm startAn online IDE will be accessible at localhost:4001/graphql allowing you to explore the API.
npm installWe need create the environment variables the application needs, but with some test appropriate values. We can do that by creating test.env in the API root directory with the following command.
cat <<'EOF' > test.env
AZURE_CONN_STRING=connection string
DATABASE=database
SUMMARIES_CONTAINER=summaries
API_CONTAINER=api
SUPER_ADMIN_TOKEN=sa-token
DMARC_REPORT_API_SECRET=test-secret
TOKEN_HASH=test-hash
DMARC_REPORT_API_TOKEN=test-token
DEPTH_LIMIT=2
COST_LIMIT=100
SCALAR_COST=1
OBJECT_COST=1
LIST_FACTOR=1
EOFFinally, run the tests.
npm testnpm run test-coveragenpm run lintnpm run prettierSee CONTRIBUTING.md
Unless otherwise noted, the source code of this project is covered under Crown Copyright, Government of Canada, and is distributed under the MIT License.
The Canada wordmark and related graphics associated with this distribution are protected under trademark law and copyright law. No permission is granted to use them outside the parameters of the Government of Canada's corporate identity program. For more information, see Federal identity requirements.
L'API du rapport DMARC est exclusivement axée sur le service des données, plutôt que sur le HTML. Il s'agit d'une API GraphQL, choisie pour sa composabilité, sa lisibilité et pour la façon dont elle permet à la fois la sécurité et l'automatisation de la sécurité. Elle est construite avec le serveur web Express en utilisant le middleware apollo-serveur-express, et suit les spécifications du relais pour la pagination.
npm installConformément à la philosophie de 12Factor app, le serveur tire sa configuration de l'environnement. Il se base sur un fichier .env qui devrait exister à la racine du dossier de l'API et qui peut être créé avec la commande suivante, en modifiant évidemment les valeurs de test affichées pour s'adapter à votre configuration.
cat <<'EOF' > test.env
AZURE_CONN_STRING=connection string
DATABASE=database
SUMMARIES_CONTAINER=summaries
API_CONTAINER=api
SUPER_ADMIN_TOKEN=sa-token
DMARC_REPORT_API_SECRET=test-secret
TOKEN_HASH=test-hash
DMARC_REPORT_API_TOKEN=test-token
DEPTH_LIMIT=2
COST_LIMIT=100
SCALAR_COST=1
OBJECT_COST=1
LIST_FACTOR=1
EOFUne fois cela défini, vous pouvez démarrer le serveur avec ces commandes.
# Lancer le serveur
npm startUn IDE en ligne sera accessible à localhost:4001/graphql vous permettant d'explorer l'API.
npm installNous devons créer les variables d'environnement dont l'application a besoin, mais avec des valeurs appropriées de test. Nous pouvons le faire en créant test.env dans le répertoire racine de l'API avec la commande suivante.
cat <<'EOF' > test.env
AZURE_CONN_STRING=connection string
DATABASE=database
SUMMARIES_CONTAINER=summaries
API_CONTAINER=api
SUPER_ADMIN_TOKEN=sa-token
DMARC_REPORT_API_SECRET=test-secret
TOKEN_HASH=test-hash
DMARC_REPORT_API_TOKEN=test-token
DEPTH_LIMIT=2
COST_LIMIT=100
SCALAR_COST=1
OBJECT_COST=1
LIST_FACTOR=1
EOFEnfin, faites les tests.
npm testnpm run test-coveragenpm run lintnpm run prettierVoir CONTRIBUTING.md
Sauf indication contraire, le code source de ce projet est protégé par le droit d'auteur de la Couronne du gouvernement du Canada et distribué sous la licence MIT.
Le mot-symbole « Canada » et les éléments graphiques connexes liés à cette distribution sont protégés en vertu des lois portant sur les marques de commerce et le droit d'auteur. Aucune autorisation n'est accordée pour leur utilisation à l'extérieur des paramètres du programme de coordination de l'image de marque du gouvernement du Canada. Pour obtenir davantage de renseignements à ce sujet, veuillez consulter les Exigences pour l'image de marque.