Skip to content
Guillaume Hector edited this page Feb 11, 2022 · 13 revisions

The 'me' logic

All API routes are under the meMiddleware

It enables using me as userId in route parameters to refer to the user currently logged in

router.get('users/:userId');

// GET /users/me

Linter

Code styling is handled by eslint

We're using the AirBnb configuration extended for typescript. It will ensure coherence across the whole codebase, and make sure you're following general good practices

Use npm run lint to check coding style and automatically fix errors

Linter

Logger

The application comes with a custom logger made with winston.

It allows you to output nicely formated logs as simply as

logger.info('Server listening on 8000')

Error logs are written into logs/error.log, and a mix of all logs level from info are written into logs/all.log

In production mode, logs are not written in stdout, only in files

This is essential as console.log is a blocking operation

It reduces the IO usage too

Additionally, all requests are automatically logged too, thanks to morgan

Logs

Code documentation

Coming soon

Clone this wiki locally