Move routes and schema to /app
This commit is contained in:
parent
0f0be6ec14
commit
5bc06f5cd4
3 changed files with 6 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ import express from 'express'
|
||||||
import mongoose from 'mongoose'
|
import mongoose from 'mongoose'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import routes from './routes'
|
import routes from './app/routes'
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@ import { Application } from 'express'
|
||||||
import Urls from './schema'
|
import Urls from './schema'
|
||||||
|
|
||||||
export default (app: Application) => {
|
export default (app: Application) => {
|
||||||
|
|
||||||
|
app.get('/', async(req, res) => {
|
||||||
|
res.render('home')
|
||||||
|
})
|
||||||
|
|
||||||
app.get('/:id', async (req, res) => {
|
app.get('/:id', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const urlObj = await Urls.findById(req.params.id);
|
const urlObj = await Urls.findById(req.params.id);
|
||||||
Loading…
Reference in a new issue