feat(api-user): add basic User Entity and basic routing to fetch all users

This commit is contained in:
sct
2020-08-17 03:12:00 +00:00
parent ccfd223f0f
commit d902ef7277
9 changed files with 92 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
import express from 'express';
import next from 'next';
import { createConnection } from 'typeorm';
import routes from './routes';
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
@@ -12,9 +13,7 @@ app
.prepare()
.then(() => {
const server = express();
server.get('/api', (req, res) => {
res.json({ worked: true });
});
server.use('/api', routes);
server.get('*', (req, res) => handle(req, res));
const port = Number(process.env.PORT) || 3000;