diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..93f1361 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5507ee3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:10 + +# Create app directory +WORKDIR /usr/src/app + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +# where available (npm@5+) +COPY package*.json ./ + +RUN npm install --only=production +# If you are building your code for production +# RUN npm install --only=production + +# Bundle app source +COPY . . + +EXPOSE 4201 +CMD [ "npm", "start" ] diff --git a/bin/feed2json-server b/bin/feed2json-server index 602ba16..994cec0 100644 --- a/bin/feed2json-server +++ b/bin/feed2json-server @@ -6,7 +6,6 @@ const feed2jsonServer = require('../lib/index.js'); const server = feed2jsonServer({ port: 4201, - host: 'localhost', routes: { cors: true } }); diff --git a/lib/index.js b/lib/index.js index ea8663c..8dd7201 100644 --- a/lib/index.js +++ b/lib/index.js @@ -34,6 +34,20 @@ const getServer = (hapiOptions) => { }) }; + server.route({ + method: 'GET', + path: '/', + handler: () => { + return { + description: "This is a feed2json conversion service. It can be used to convert rss feeds in xml format to the jsonfeed standard.", + example: `/example`, + conversion: `/convert?url=http://feeds.reuters.com/reuters/topNews`, + github: "https://github.com/alexlangberg/node-feed2json-server", + npm: "https://www.npmjs.com/package/feed2json-server", + } + } + }); + server.route({ method: 'GET', path: '/example',