[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.

47 lines
1.2 KiB

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. // index.ts
  2. // Copyright (C) 2020 Dwayne Harris
  3. // This program is free software: you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation, either version 3 of the License, or
  6. // (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. import { config } from 'dotenv'
  14. import { resolve } from 'path'
  15. import fastify from 'fastify'
  16. import fastifyStatic from 'fastify-static'
  17. import api from './api'
  18. config()
  19. const server = fastify({
  20. logger: {
  21. level: process.env.LOGGER_LEVEL,
  22. prettyPrint: process.env.LOGGER_PRETTY_PRINT === 'true',
  23. }
  24. })
  25. server.register(api)
  26. server.register(fastifyStatic, {
  27. root: resolve(__dirname, '..', 'apps'),
  28. })
  29. const start = async () => {
  30. try {
  31. await server.listen(process.env.PORT!)
  32. } catch (err) {
  33. process.exit(1)
  34. }
  35. }
  36. start()