This is the backend application providing a REST API to MoveAI react app. This application is built using Node.js, Express, and Postgres.
To get started with the MoveAI Backend, follow these steps:
- Clone the repository:
git clone https://github.com/jokatty/moveAi-backend.git
- Install dependencies:
npm install
- Update your database details in the configuration file located at
config/config.js. - Create the database by running:
npx sequelize db:create. - Apply migrations to set up tables:
npx sequelize db:migrate.
Before using the API, you need to set up Google Cloud Bucket and Vision API. Follow these steps:
Create a Google Cloud Storage Bucket to store images.
Enable the Google Cloud Vision API for your project.
Ensure that the necessary environment variables are set.
GCLOUD_STORAGE_BUCKET=your-bucket-name
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/keyfile.jsonnpm start
POST /api/upload
This endpoint allows users to upload images to the MoveAI Backend. Upon receiving an image, the backend makes use of Google's Vision API to analyze the content and extract various annotations.
- Method:
POST - Route:
/api/upload - Body: Form data with the image file
Upon successful analysis, the API responds with a JSON object containing various annotations:
{
"faceAnnotations": [],
"landmarkAnnotations": [],
"logoAnnotations": [],
"labelAnnotations": [],
"textAnnotations": [],
"localizedObjectAnnotations": [
/* List of objects */
{
"name": "exampleObject",
"score": 0.85
}
// Additional objects...
]
}