chore: hardcode api location

This commit is contained in:
Pitu 2021-06-20 18:53:59 +09:00
parent a4c447bb8b
commit 270b7acd4c
2 changed files with 3 additions and 3 deletions

View File

@ -76,8 +76,8 @@ class Server {
for (const File of routes) { for (const File of routes) {
try { try {
const route = new File(); const route = new File();
this.server[route.method](Util.config.routePrefix + route.path, route.authorize.bind(route)); this.server[route.method](`/api${route.path}`, route.authorize.bind(route));
log.info(`Found route ${route.method.toUpperCase()} ${Util.config.routePrefix}${route.path}`); log.info(`Found route ${route.method.toUpperCase()} /api${route.path}`);
} catch (e) { } catch (e) {
log.error(`Failed loading route from file ${routeFile} with error: ${e.message}`); log.error(`Failed loading route from file ${routeFile} with error: ${e.message}`);
} }

View File

@ -40,7 +40,7 @@ class Util {
static getEnvironmentDefaults() { static getEnvironmentDefaults() {
return { return {
domain: process.env.DOMAIN, domain: process.env.DOMAIN,
routePrefix: process.env.ROUTE_PREFIX || '/api', routePrefix: '/api',
rateLimitWindow: process.env.RATE_LIMIT_WINDOW || 2, rateLimitWindow: process.env.RATE_LIMIT_WINDOW || 2,
rateLimitMax: process.env.RATE_LIMIT_MAX || 5, rateLimitMax: process.env.RATE_LIMIT_MAX || 5,
secret: process.env.SECRET || randomstring.generate(64), secret: process.env.SECRET || randomstring.generate(64),