1 import { config as dotenv } from 'dotenv';
2 import { server, WrappedApiEndpointHandler } from './lib/server';
3 import { prisma } from './lib/db';
4 import { logger } from './lib/logger';
5 import * as routes from './routes';
6 import { each } from 'lodash';
10 each(routes, route => {
11 server.express[route.method](route.path, route.handler);
15 server.start(process.env.PORT || '9090').catch(err => {
20 setInterval(async () => {
21 await prisma.$transaction([
22 prisma.$queryRaw`update "Player" set stamina = stamina + 1 where stamina < (woosh * level + 19)`,
23 prisma.$queryRaw`update "Player" set hp = hp + 1 where hp < (zest * 3 + 2 * level)`
25 logger.info('Updated HP and Stamina');