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.
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:
- Set up your local PostgreSQL database.
- Ensure that PostgreSQL is running on port
5432
(or update the.env
file with your custom port).
- Clone this repository to your local machine.
- Navigate to the project root directory in your terminal.
- Run
yarn
to install all the necessary dependencies. - 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.
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.
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.
This project is open-sourced under the MIT License. See the LICENSE file for more information.