Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khoido2003/hapi-nodejs
RESTFul API with Hapi + Nodejs + MongoDB
https://github.com/khoido2003/hapi-nodejs
hapijs mongodb nodej restful-api
Last synced: 21 days ago
JSON representation
RESTFul API with Hapi + Nodejs + MongoDB
- Host: GitHub
- URL: https://github.com/khoido2003/hapi-nodejs
- Owner: khoido2003
- Created: 2024-06-04T08:48:25.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-14T03:22:27.000Z (7 months ago)
- Last Synced: 2024-06-14T14:26:17.789Z (7 months ago)
- Topics: hapijs, mongodb, nodej, restful-api
- Language: JavaScript
- Homepage:
- Size: 165 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Hapi Node.js API Project
## Introduction
This project demonstrates how to create a RESTful API using Hapi.js with Node.js. The API supports basic CRUD operations and includes authentication using JWT (JSON Web Tokens).
## Features
- **Hapi.js Framework**: Robust and scalable web framework for building APIs.
- **JWT Authentication**: Secure user authentication using JSON Web Tokens.
- **CRUD Operations**: Basic Create, Read, Update, and Delete functionalities.
- **Error Handling**: Graceful error handling using Boom.
- **Data Validation**: Request payload validation using Joi.## Prerequisites
- **Node.js**: Ensure you have Node.js installed. You can download it from [nodejs.org](https://nodejs.org/).
- **npm**: Node package manager is installed with Node.js.## Installation
1. **Clone the repository**:
```sh
git clone https://github.com/khoido2003/Hapi-Nodejs.git
```
2. **Install Dependencies**:```sh
npm install
```3. **Start the Project**:
```sh
npm run start
```## Configuration
Before running the application, you need to set up the configuration variables. Create a `.env` file in the root directory of the project and add the following variables:
```env
NODE_ENV=''HAPI_PORT=''
HAPI_HOST=''MONGODB_URI=''
JWT_SECRET=''
JWT_EXPIRES_IN=''
JWT_COOKIE_EXPIRES_IN=''
```## Technologies Used
- [Hapi](https://hapi.dev/)
- [Nodejs](https://nodejs.org)