Giter Club home page Giter Club logo

nodejs_hw's Introduction

NODEjs_HW

Informal School of IT - Node.js Project (Express.js)

A sequel of the Students vs Teachers Project

Data is stored in a MySQL database, having 3 main tables: students teachers grades (a simple, one-to-one relationship to students table)

The website is server-side rendered, using Express.js framework on the backend, with EJS (EmbeddedJS) templating. Routes are implemented via ExpressRouter. The codebase uses ES6 modules, and while the import syntax isn't available yet in Node.js environment, this feature can be used with the help of Babel:

// ./start.js file, example is assuming server.js to be the entry point for the app

require('babel-register')({
  presets: ['env']
})

module.exports = require('./server.js')

ES6 Classes encapsulate the logic for all queries needed for resource-fetching. Node.js uses the mysql module to execute the queries. For other AJAX calls, I used the axios module. Landing page show a preview of REST API methods available. HTTP methods were implemented in the HTML template using PUT, DELETE, inclusively, with the aid of the npm method-override module.

Landing Page

Returned data:

Returned JSON list

Main page exposes basic CRUD functionality: Create a new Student/Teacher Read entities Update existing entities Destroy records

Main Page

The forms for adding new and editing an existing resource are very similar. It would've been a great use-case for a component-driven pattern, like in an Ember/Angular framework/ I'm sorry to dissapoint, but this is not the case, since a dedicated template was implemented for every form state. The screenshots below depict the forms side-by-side.

add/edit student add/edit teacher

nodejs_hw's People

Contributors

cristianioanin avatar

Watchers

James Cloos 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.