/api

Api server for ant colony quantitative platform

Primary LanguageTypeScriptMIT LicenseMIT

Ant Server

Ant Server is a GraphQL-based server-side application that interacts with a PostgreSQL database. This project is set up using Node.js and can be utilized as a starting point for building robust backend services.

Environment setup

Before you begin, make sure you have Node.js and Yarn package manager installed on your machine. You will also need PostgreSQL installed and running locally.

Follow these steps to set up your environment:

Database Setup

  1. Set up your local PostgreSQL database.
  2. Ensure that PostgreSQL is running on port 5432 (or update the .env file with your custom port).

Application Setup

  1. Clone this repository to your local machine.
  2. Navigate to the project root directory in your terminal.
  3. Run yarn to install all the necessary dependencies.
  4. Create a .env file in the root directory and add the following environment variables:
DB_NAME=toguDb
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=TOUGU_ADMIN
JWT_SECRET=hello_tougu

Make sure to replace TOUGU_ADMIN with the actual password for your local PostgreSQL instance.

Start Developing Work

Once the environment setup is complete, you can start the development server:

Run yarn start for a production server or yarn start:dev for a development server. Navigate to http://localhost:3000/graphql in your web browser to test queries and mutations using the interactive GraphQL playground.

Test

The project comes with pre-configured unit and end-to-end (e2e) tests. To run these tests and check code coverage, use the following commands:

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

These tests are essential for ensuring your application runs correctly before deployment.

License

This project is open-sourced under the MIT License. See the LICENSE file for more information.