Giter Site home page Giter Site logo

tomsarduy / express-react-departures Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 746 KB

Web application using node, react and redux to display train services departing from a selected station

JavaScript 96.23% HTML 0.81% CSS 2.96%
expressjs react jest jsx api-client api-server

express-react-departures's Introduction

#Express React Departures Simple 3 page web application using node, webpack, react and redux to display train services departing from a selected station, using Trainline Realtime API.

##Features:

  • Responsive layout
  • Autocomplete to select departure station
  • Automatically update departures in realtime
  • Automatically update train in progress

##Project Structure

Server

modules/
├── common
│   ├── api-parser.js
│   ├── operators.js
│   └── stations.js
├── departures
│   ├── handler.js
│   └── index.js
└── services
    ├── handler.js
    └── index.js

Each module has a route definition and a custom handler for that route. In the common module are the api parser, the train stations, and train operators.

Client

src
├── index.js
├── index.test.js
├── configureStore.js
├── actions/
├── components/
│   ├── DepartureSelect/
│   ├── Error/
│   ├── Header/
│   ├── ServiceDetails/
│   ├── TrainServices/
│   └── Wrapper/
├── constants
├── containers
├── middlewares
├── reducers
└── router

##Install

Express server dependencies

npm install

Client-side dependencies (React, Redux, Webpack, Babel, ESLint, etc):

cd client && npm install

This project was bootstrapped with Create React App and Express Generator. If there is any missing dependency or you have any error, try to solve it running yarn.

##Available scripts:

npm start

The project is using concurrently to run both express and webpack-dev-server in the same console. Be sure you are in the root of the project before running this command, otherwise will only run the client side and the API requests won't work.

You should see the app up and running at http://localhost:3000

npm test

For testing the project uses Jest as its test runner, and Enzyme to better traverse the components output.

When you run npm test, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests. If you want to run all the test, just press a. More details here

npm run server

Will only run express server on port 3001.

npm run client

Will only run webpack-dev-server on port 3000.


###Pending:

  • Add tests on server side
  • Integrate React Helmet to manage the document head (title, meta, canonical)
  • Transition between routes
  • Integration with React Bootstrap

###Notes:

  • Express is a middleware between https://realtime.thetrainline.com/departures/ endpoint and the client side.
  • The project is proxying API requests to http://localhost:3001 where express is running. Webpack web server provide an option for that in package.json. More in here

express-react-departures's People

Contributors

tomsarduy avatar

Stargazers

 avatar

Watchers

 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.