https://github.com/namangupta123/gramify_server
Server for Gramify.
https://github.com/namangupta123/gramify_server
backend-api expressjs framework helper langchain-js mistral node-js nodemon server service
Last synced: 6 months ago
JSON representation
Server for Gramify.
- Host: GitHub
- URL: https://github.com/namangupta123/gramify_server
- Owner: Namangupta123
- License: mit
- Created: 2025-02-22T17:15:15.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-22T17:54:30.000Z (about 1 year ago)
- Last Synced: 2025-02-22T18:34:49.139Z (about 1 year ago)
- Topics: backend-api, expressjs, framework, helper, langchain-js, mistral, node-js, nodemon, server, service
- Language: JavaScript
- Homepage: https://gramify-server.vercel.app
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
The `server.js` file contains the backend logic for a grammar correction assistant API using the MistralAI model. It utilizes Express for handling HTTP requests and responses.
### Setup
1. Install dependencies by running `npm install`.
2. Create a `.env` file and add your Mistral API key as `MISTRAL_API_KEY=your_api_key_here`.
3. Start the server by running `node server.js`.
### API Endpoints
- `POST /fix-grammer`:
- Description: Corrects grammar mistakes in the provided text.
- Request Body:
```
{
"text": "Text to be corrected"
}
```
- Response:
```
{
"correctedText": "Corrected text"
}
```
- `GET /`:
- Description: Returns a status message indicating the server is running.
### Error Handling
- If no text is provided in the request body for `/fix-grammer`, a `400` status with an error message will be returned.
- If there is an internal server error, a `500` status with an error message will be returned.
### Dependencies
- Express
- Cors
- Dotenv
- @langchain/mistralai
- @langchain/core/prompts
### Environment Variables
- `MISTRAL_API_KEY`: API key for the MistralAI model.
### Usage
You can send a POST request to `/fix-grammer` with a JSON body containing the text to be corrected.
### Contributions
We welcome contributions to improve this grammar correction assistant API. Feel free to submit pull requests with enhancements, bug fixes, or new features.