mirror of
https://github.com/directus/directus.git
synced 2026-02-15 16:05:06 -05:00
Add database.ts
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
import express from 'express';
|
||||
import asyncHandler from 'express-async-handler';
|
||||
import APIError, { errorHandler, ErrorCode } from './error';
|
||||
import database from './database';
|
||||
|
||||
const app = express()
|
||||
.get(
|
||||
'/',
|
||||
asyncHandler(async (req, res, next) => {
|
||||
throw new APIError(ErrorCode.NOT_FOUND, 'Route `/` not found');
|
||||
const records = await database.select('*').from('articles');
|
||||
res.json(records);
|
||||
})
|
||||
)
|
||||
.use(errorHandler);
|
||||
|
||||
Reference in New Issue
Block a user