Move routes and schema to /app

This commit is contained in:
oitsjustjose 2020-06-28 10:50:42 -05:00
commit 5bc06f5cd4
3 changed files with 6 additions and 1 deletions

View file

@ -3,7 +3,7 @@ import express from 'express'
import mongoose from 'mongoose'
import path from 'path'
import routes from './routes'
import routes from './app/routes'
const app = express()

View file

@ -2,6 +2,11 @@ import { Application } from 'express'
import Urls from './schema'
export default (app: Application) => {
app.get('/', async(req, res) => {
res.render('home')
})
app.get('/:id', async (req, res) => {
try {
const urlObj = await Urls.findById(req.params.id);