oh-my-c0de/oh-my-fullstack

View on GitHub
server/routes/index.js

Summary

Maintainability
A
0 mins
Test Coverage
import { Router } from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import { status } from '../handlers/status';
import { errors } from '../handlers';


const router = new Router();

router.use(
  cors({ origin: true }),
  bodyParser.json(),
  bodyParser.urlencoded({ extended: false }),
);

router.get('/', status);

// error handling
router.use(
  errors.notFound,
  errors.format,
  errors.handler,
);

export default router;