1.0.0 • Published 2 years ago

cornel v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

GitHub contributors GitHub forks GitHub issues GitHub GitHub code size in bytes

About The Project

Morgan is one of the best logging middlewares for Express.js but, It's a little bit tough to work with it. It's also heavy (about 30kb). Cornel is a middleware which more focuses on being easy to use. It's also light (> 5kb)

Built With

Prerequisites

  • npm
    npm install npm@latest -g
  • Node js
  • Express.js
    npm i express

Installation

npm i cornel

Usage

Frist require express:

const express = require("express")
const app = express()

then require cornel:

const cornel = require("cornel")

Use it

app.use(cornel("Things to log")

You can put tokens in cornel parameter. Every time a request is made cornel will log the string you wrote there.

API

this list is about tokens you can use. :url:: same as req.url :method:: same as req.method :date:: same as Date().toString() :date-iso:: same as Date().toISOString() :date-utc: same as Date().toUTCString() :http-version: : same as req.httpVersion :refferer:: same as req.headers.referer :remote-addr:: same as req.ip if it's empty it will use req.connection.remoteAddress :status:: same as res.statusCode

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Project Link: https://github.com/mehanalavimajd/cornel Email: mehan.alavi.88.majd@gmail.com

1.0.0

2 years ago