UNPKG

teleprice-quoting-system

Version:

a live feed pricing system for exchanges, wire services, and telegraphic news. Use in indexing pricing and matching indexed prices.

38 lines (29 loc) 753 B
// Using Node.js `require()` const mongoose = require('mongoose'); // Using ES6 imports import mongoose from 'mongoose'; // api.js let Hapi = require('@hapi/hapi') let mongoose = require('mongoose') let RestHapi = require('rest-hapi') async function api() { try { let server = Hapi.Server({ port: 8080 }) let config = { appTitle: "My API", }; await server.register({ plugin: RestHapi, options: { mongoose, config } }) await server.start() console.log("Server ready", server.info) return server } catch (err) { console.log("Error starting server:", err); } } module.exports = api()