<commit_before>const user = require('../../db/user.js')
const router = require('express').Router()

router.get('/', (req, res) => {
  res.render('splash-page')
})

router.route('/signup')
  .get((req, res) => {
    res.render('signup')
  })
  .post((req, res) => {
    const name = req.body.name
    const username = req.body.username
    const email = req.body.email
    const password = <PASSWORD>
    user.create(name, username, email, password)
      .then(res.redirect('/login'))
  })

router.route('/login')
 .get((req, res) => {
    res.render('login')
  })
router.post('/login', (req, res) => {
   const username = req.body.username
   const password = <PASSWORD>
   user.getByUsername(username)
    .then(user => {
      if (password === <PASSWORD>) {
        req.session.user = user
        res.redirect(`/profile/${username}`)
      }
      else {
        res.send('sorry, wrong password')
      }
    })
  })

router.route('/logout')
  .get((req, res) => {
    req.session.destroy()
    res.redirect('/')
  })

router.get('/profile/:username', (req, res) => {
  const username = req.params.username
  user.getByUsername(username)
    .then(user => res.render('profile', {user}))
    .catch(error => console.log(error))
})

module.exports = router<commit_msg>minor cleanup to whitespace formatting<commit_after>const user = require('../../db/user.js')
const router = require('express').Router()

router.get('/', (req, res) => {
  res.render('splash-page')
})

router.route('/signup')
  .get((req, res) => {
    res.render('signup')
  })
  .post((req, res) => {
    const name = req.body.name
    const username = req.body.username
    const email = req.body.email
    const password = <PASSWORD>.body.password
    user.create(name, username, email, password)
      .then(res.redirect('/login'))
  })

router.route('/login')
  .get( (req, res) => res.render('login') )
  .post( (req, res) => {
    const username = req.body.username
    const password = req.body.password
    user.getByUsername(username)
      .then(user => {
        if (password === user.password) {
          req.session.user = user
          res.redirect(`/profile/${username}`)
        }
        else res.send('sorry, wrong password')
      })
  })

router.route('/logout')
  .get((req, res) => {
    req.session.destroy()
    res.redirect('/')
  })

router.get('/profile/:username', (req, res) => {
  const username = req.params.username
  user.getByUsername(username)
    .then(user => res.render('profile', {user}))
    .catch(error => console.log(error))
})

module.exports = router
{'fraction_non_alphanumeric': 0.19509345794392524, 'fraction_numerical': 0.0, 'mean_word_length': 2.9221374045801527, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1436686', 'n_tokens_mistral': 841, 'n_tokens_neox': 842, 'n_words': 158}