Git Product home page Git Product logo

optim-test's Introduction

RESTful NodeJS web application with a single endpoint to parse XML information from a text source and return the relevant data.

The endpoint /parse-content will accept a POST request containing, in the request body, the plain text content to be parsed.

The expected responses from the endpoint are:

  • 200 - If the application was able to parse the data.

    • The response body will include a JSON object with the formatted data.
  • 400 - If the request can not be fulfilled because of a client error (a malformed XML content, for example).

    • The same error will be returned if the content does not satisfy the following conditions:
      1. Opening tags without a corresponding closing tag.
      2. Missing <total> tag and/or value.
      3. Missing <cost_centre> tag and/or value.
  • 500 - If something went wrong on the API side.

    • A readable message will be returned to the client with non-technical details.

This is a NodeJS application using Express and was bootstrapped using the Express generator tool.

Running the app

  1. Clone this repo
  2. CD into the folder
  3. The app will use port 3001 by default. You can change this setting by setting up an environment variable PORT={port#} or changing the default port on the file /bin/www:15.
  4. Set NODE_ENV to “production”.
  5. Run npm install.
  6. Finally npm start to start the app.
  7. You can start consuming the endpoint using http://localhost:{port}/parse-content.

optim-test's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.