~jae/neos-headless-manager

ae07feb02f4a1f06ff2b984881ae20dd7d6b0ee8 — Jae Lo Presti (DN0) 7 months ago 8a69436
src: add base of fastify setup
3 files changed, 21 insertions(+), 4 deletions(-)

A src/environment.ts
M src/index.ts
A src/routes/.gitkeep
A src/environment.ts => src/environment.ts +2 -0
@@ 0,0 1,2 @@
export const PRODUCTION: boolean = process.env.NODE_ENV == 'production';
export const HOST: string = process.env.HOST ?? 'localhost';
\ No newline at end of file

M src/index.ts => src/index.ts +19 -4
@@ 1,5 1,20 @@
const test = () => {
    console.log("test");
}
import fastify from 'fastify';
import autoLoad from '@fastify/autoload';
import {HOST, PRODUCTION } from "./environment";
import { join } from 'path';

test();
const server = fastify({
    logger: !PRODUCTION,
});

void server.register(autoLoad, {
    dir: join(__dirname, 'routes'),
});

server.listen({ port: 8080, host: HOST }, (err, address) => {
    if (err) {
        console.log(err);
        process.exit(1);
    }
    console.log(`Server is starting on ${address}`);
})
\ No newline at end of file

A src/routes/.gitkeep => src/routes/.gitkeep +0 -0