Giter Site home page Giter Site logo

newslabs-io's Introduction

News Labs I/O

A News Labs application prototype to be used during code interviews.

The idea of this application is to allow the public to submit tips to the BBC in a secure manner and for journalists to manage the incoming tips and react to them.

The client is written in Typescript/React and the API is available in either Python or Node/Typescript. You can choose the API which best suits your skills.

Requirements

The JavaScript has been tested using Node.js 16 and Python 3.9 on macOS 12 (Monterey).

Before the interview

  • Ensure you have a working Node.js (and Python if applicable) environment

For the JavaScript code (in js/client and js/api, if using):

  • Install dependencies: npm install
  • The tests should all pass: npm test
  • The application should run: npm start

For the Python code (in /python/api):

  • Create a virtual environment, e.g. python3 -m venv nlio
  • Install the requirements: pip install -r requirements.txt
  • Run the API server: uvicorn main:app --port 8080

Next:

  • You should be able to open the application in the browser: http://localhost:3000
  • The "Submissions" tab should show three submissions like the following screenshot:

Submissions

If you get stuck with any of the above, please reach out to [email protected] with the position you're applying for and the issue you're having.

In interview, we want to use your machine. We will be using Zoom and the screen share functionality, which works best with the app installed. Please get in touch if that is not possible.

Please familiarise yourself with a drawing tool to touch on architecture diagram during the interview. Popular and free online ones are excalidraw, draw.io or Google Draw (the latter requires a Google Account).

Used Libraries

JS Server-side

Python Server-side

Client-side

JS Supporting

  • jest for tests (running, mocking, asserting)
  • supertest for backend tests (environment for server-side app)
  • enzyme 3 for frontend tests (renders react components)
  • webpack for bundling react
  • eslint for linting

Client

The source code for this is in the js/client directory.

This app includes a stand-alone react-based client application, written in TypeScript.

This application is built by webpack and ts-loader only, and does not make use of babel.

The webpack config also creates an index.html to load the react application.

start

The npm start script launches the client on http://localhost:3000.

build

The npm run build script runs tsc to build the client application. This will be output into /dist.

test

The npm test script runs jest for the unit tests.

JavaScript API

The source code for this is in the js/api directory.

This app includes a stand-alone express-based API server application, written in TypeScript.

start

The npm prestart script will execute first, which initialises the development database (in /sql/dev.db).

The npm start script launches the ./src/server.ts file, with the API express app on http://localhost:8080.

build

The npm run build script runs tsc to build the server-side application. This will be output into /dist.

test

The npm pretest script will execute first, which initialises the development database (in /sql/dev.db).

The npm test script runs jest for the unit tests.

Python API

The source code for this is in the python/api directory.

This app includes a stand-alone FastAPI-based API server application.

You'll need to initialise the database in the sql/ directory via the following commands run within the root of the repo:

$ cat sql/createSchema.sql sql/createData.sql | sqlite3 sql/dev.db

start

Start the server with uvicorn main:app --port 8080 run from the python/api/ directory.

newslabs-io's People

Contributors

bennuttall avatar niklasr avatar rjw57 avatar tamsingreen avatar

Stargazers

 avatar  avatar  avatar

Watchers

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