This project is a basic API with MySQL database integration.
This project provides a basic API that interacts with a MySQL database. It includes CRUD operations for managing data.
- Basic API setup with Node.js and Express
- MySQL database integration
- CRUD operations (Create, Read, Update, Delete)
- Node.js installed
- MySQL database setup
- Clone the repository:
git clone https://github.com/rabbihossainlhp/MobileApp_API.git
This is a simple API for managing district information. It allows you to create, update, retrieve, and delete district information.
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
Install the dependencies:
npm install
-
environment variable should like this:
DB_HOST=your_database_host DB_USER=your_database_user DB_PASSWORD=your_database_password DB_NAME=District_Info DB_PORT=3306 PORT=3535 # Replace the placeholder values with your actual database credentials.
##Running the API
- Start the server:
npm start
- The server will be running at http://localhost:3535.
The live API is hosted at: https://mobileappapi-production.up.railway.app/
Create a District
URL: /api/create-item
Method: POST
Body:
{
"name": "District Name",
"description": "District Description"
}
Response:
201 Created
500 Internal Server Error
Get single Items
URL: /api/singleitem/:id
Method: GET
Response:
201 Created
404 Not Found
500 Internal Server Error
Update single Items
URL: /api/updateitem/:id
Method: POST
Body:
{
"name": "District Name",
"description": "District Description"
}
Response:
201 Updated
404 Not Found
500 Internal Server Error
Delete single Items
URL: /api/updateitem/:id
Method: POST
Body:
{
"name": "District Name",
"description": "District Description"
}
Response:
201 Deleted
404 Not Found
Get all Items
URL: /api/allitem/
Method: GET
Response:
201 SuccessFully founded all info
404 Not Found