Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raj-pulapakura/build-graphql-api

Build a beautiful, organised Graphql API with Typescript and Typeorm support, and pre-built examples, all with a single command!
https://github.com/raj-pulapakura/build-graphql-api

Last synced: 3 days ago
JSON representation

Build a beautiful, organised Graphql API with Typescript and Typeorm support, and pre-built examples, all with a single command!

Awesome Lists containing this project

README

        

# build-graphql-api

## Description

```build-graphql-api``` allows you to construct an amazing Graphql API with the following built-in features:

- Typescirpt
- Typeorm (for database connections)

## Usage

Run the following command:

```
npx build-graphql-api [DIR]
```

## Imporant Information

### Configuring the database

Before starting the api, go to the ```.env``` file in the root directory and enter your database credentials. You can also change the port the server will run on. ***If you do not do this, the api will crash.***

The api uses ```mysql``` be default. To change this, head over to the ```config/db.ts``` file.

### Cors

```cors``` is already taken care of, but if you need to adjust the configuration, for e.g. adding a new origin, head over to the ```src/index.ts``` file.

### Pre-built features

The api comes with 2 fully-functional features built-in: an Author model as well as a Book model. Feel free to delete these if you do not need them.

### Starting the server

Finally, to start the server, run the following command:

```
npm run dev
```

The api uses ```concurrently``` to run the typescript watcher and the nodemon server at the same time.