[ABANDONDED] Set of "apps" for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
576 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import { config } from 'dotenv'
  2. import { resolve } from 'path'
  3. import fastify from 'fastify'
  4. import fastifyStatic from 'fastify-static'
  5. import api from './api'
  6. config()
  7. const server = fastify({
  8. logger: {
  9. level: process.env.LOGGER_LEVEL,
  10. prettyPrint: process.env.LOGGER_PRETTY_PRINT === 'true',
  11. }
  12. })
  13. server.register(api)
  14. server.register(fastifyStatic, {
  15. root: resolve(__dirname, '..', 'apps'),
  16. })
  17. const start = async () => {
  18. try {
  19. await server.listen(process.env.PORT!)
  20. } catch (err) {
  21. process.exit(1)
  22. }
  23. }
  24. start()