https://github.com/ref-bit/express-winston-mysql-typescript-starter-template
A starter template with expressjs & winston & mysql & typescript.
https://github.com/ref-bit/express-winston-mysql-typescript-starter-template
Last synced: 12 months ago
JSON representation
A starter template with expressjs & winston & mysql & typescript.
- Host: GitHub
- URL: https://github.com/ref-bit/express-winston-mysql-typescript-starter-template
- Owner: Ref-Bit
- License: mit
- Created: 2024-10-07T09:01:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-25T09:31:03.000Z (over 1 year ago)
- Last Synced: 2025-01-27T13:27:14.765Z (about 1 year ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Express + Winston + MySQL + Typescript Starter Template
## Description
This template created for quicker supports the following tools:
* [cors](https://github.com/expressjs/cors#readme) - Enable CORS with various options on your server.
* [dotenv](https://github.com/motdotla/dotenv#readme) - zero-dependency module that loads environment variables.
* [expressjs](http://expressjs.com) - Fast, unopinionated, minimalist web framework for Node.js.
* [helmet](https://helmetjs.github.io) - Helps you secure your Express apps by setting various HTTP headers.
* [mysql2](https://sidorares.github.io/node-mysql2/docs) - fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS.
* [morgan](https://github.com/expressjs/morgan#readme) - HTTP request logger middleware for node.js.
* [winston](https://github.com/winstonjs/winston#readme) - A logger for just about everything (with daily log files rotation).
### Get Started
Create environment variables file
```bash
cp .env.example .env
```
Create logs directory in the root project
```bash
mkdir logs
```
Install node modules
```bash
pnpm
```
Build the src folder
```bash
pnpm build
```
Start the project
```bash
pnpm dev
```
### Notes
Make sure to `%j` at the end of the logger to print your object variable properly.
```ts
logger.info("My Object %j", myObj);
```