Skip to main content

GraphQL and REST APIs

Express Node.js - GraphQL APIs | REST APIs

GraphQL

  • Deploy & Run GraphQL APIs
  • Customize to setup Data Federation, Data Mesh, and add Integrations
  • Refer to backend/express/README.md

REST

  • Deploy & Run REST APIs
  • Customize to setup Data Federation, Data Mesh, and add Integrations
  • Refer to backend/express/README.md
note

The generated code is set for GraphQL as default. For REST, Change variables as below in backend/express/emapi/src/app.ts

let isApiGraphql:boolean = false;
...
let isApiRest:boolean = true;

Databases Supported

info

Express implementation uses typeorm with DataSource - type : default 'mysql'. (mysql is included in package.json).

  • Databases supported for runtime are : 'mysql', 'postgres', 'mariadb', 'oracle', 'mssql'
  • Note: Please install the database npm package for the database you wish to use.
  • For Using postgresql database on Amazon RDS | AWS RDS, e.g. :

Add to package.json dependencies:

    "pg": "^8.11.0",

Define DataSource as:

export const myDataSource = new DataSource({ 
type: 'postgres',
host: '<db.client_id>.us-west-1.rds.amazonaws.com',
port: 5432,
username: 'username',
password: 'password',
database: 'database',
entities: [
Customer,
...
],
logging: true,
synchronize: false, //Caution: if set to true, typeorm attempts and applies database DDL changes
})