WebService-Boilerplate/README.md
2025-03-11 13:27:14 +07:00

76 lines
2.3 KiB
Markdown

# WebService Boilerplate
A boilerplate for a web service using NodeJS and Express.
## Installation
Install dependencies with `yarn`
```bash
yarn
```
Rename `.env.example` to `.env` and configure the environment variables.
```bash
cp .env.example .env
```
Migrate the database with `yarn sequelize db:migrate`
```bash
yarn sequelize db:migrate
```
## Usage
Build the project with `yarn build`
```bash
yarn build
```
Start the server with `yarn start`
```bash
yarn start
```
## Development
Run `yarn dev` to start a development server.
```bash
yarn dev
```
## Sequelize CLI
You can use the [Sequelize CLI](https://sequelize.org/docs/v6/cli/) to manage your database.
## Environment Variables
The following environment variables are required:
| Variable | Description |
|-------------------|-----------------------------------------------------------|
| `DB_USERNAME` | The username for the database |
| `DB_PASSWORD` | The password for the database |
| `DB_NAME` | The name of the database |
| `DB_HOSTNAME` | The hostname of the database |
| `DB_PORT` | The port of the database |
| `DB_DIALECT` | The dialect of the database |
| `DB_LOGGING` | Whether to log the queries to the console (true or false) |
| `DEV_DB_USERNAME` | The username for the development database |
| `DEV_DB_PASSWORD` | The password for the development database |
| `DEV_DB_NAME` | The name of the development database |
| `DEV_DB_HOST` | The hostname of the development database |
| `DEV_DB_PORT` | The port of the development database |
| `DEV_DB_DIALECT` | The dialect of the development database |
| `DEV_DB_LOGGING` | Whether to log the queries to the console (true or false) |
| `JWT_SECRET` | The secret for the JWT token |
| `VITE_API_URL` | The URL of the API |
## Useful information
You can use `/api/v1/auth/generatePasswordHash?password=123456` to generate a password hash for development purposes