Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)