This is the administrative API for the Gastlook Hotel Management System. It provides endpoints for managing members, organizations, and hotels.
- Member registration and authentication
- Organization management
- Hotel management
- JWT-based authentication
- Input validation
- Error handling
- POST
/api/auth/register- Register a new member - POST
/api/auth/login- Login member
- GET
/api/members/profile- Get member profile - PUT
/api/members/profile- Update member profile - PUT
/api/members/change-password- Change password
- GET
/api/organizations- Get organization details - PUT
/api/organizations- Update organization
- GET
/api/hotels- Get all hotels for an organization - GET
/api/hotels/:id- Get a specific hotel - POST
/api/hotels- Create a new hotel - PUT
/api/hotels/:id- Update a hotel - DELETE
/api/hotels/:id- Delete a hotel
- Node.js (v18 or higher)
- MySQL (v8 or higher)
- npm or yarn
- Clone the repository
- Install dependencies:
npm install
- Create a
.envfile based on.env.example - Set up the database using the schema in
database/schema.sql
Development mode:
npm run devProduction mode:
npm startPORT- Server port (default: 3000)NODE_ENV- Environment (development/production)DB_HOST- Database hostDB_PORT- Database portDB_NAME- Database nameDB_USER- Database userDB_PASSWORD- Database passwordJWT_SECRET- Secret key for JWTJWT_EXPIRES_IN- JWT expiration timeCORS_ORIGIN- Allowed CORS origin
The API uses a consistent error response format:
{
"status": "error",
"message": "Error message"
}- Password hashing using bcrypt
- JWT-based authentication
- Input validation
- CORS protection
- Error handling