{"size": 1096, "ext": "js", "max_stars_repo_path": "nlws/nlw-impulse/backend/src/routes/routes.js", "max_stars_repo_name": "VictorKayk/JavaScript", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "nlws/nlw-impulse/backend/src/routes/routes.js", "max_issues_repo_name": "VictorKayk/JavaScript", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nlws/nlw-impulse/backend/src/routes/routes.js", "max_forks_repo_name": "VictorKayk/JavaScript", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.2352941176, "max_line_length": 88, "alphanum_fraction": 0.7636861314}
const  express = require('express');

// Controllers
const { getGithub, getGithubCallback } = require('../controllers/github');
const AuthenticateUserController = require('../controllers/AuthenticateUserController');
const CreateMessageController = require('../controllers/CreateMessageController');
const GetLast3MessagesController = require('../controllers/GetLast3MessagesController');
const GetUserProfileController = require('../controllers/GetUserProfileController');
const auth = require('../middlewares/auth');

const router = express.Router();

// Github routes
// GET
router.get('/signin/github', getGithub);
// GET callback
router.get('/signin/github/callback', getGithubCallback);

// Authenticate routes
// POST
router.post('/auth', new AuthenticateUserController().handle);

// User rotes
// GET
router.get('/profile', auth, new GetUserProfileController().handle);

// Message routes
// POST
router.post('/messages', auth, new CreateMessageController().handle);
// GET last 3 messages
router.get('/messages/last', new GetLast3MessagesController().handle);

module.exports = router;
