Giter Site home page Giter Site logo

express-todos-tutorial's Introduction

Express Template

By Alex Merced (AlexMercedCoder.com)

Setup

  • create new project by clicking the template button on the main github repo for this template or by running command npx degit Alex-Merced-Templates/oop-express-template in an empty folder
  • clone the new project from github
  • run npm install from the main folder (the one with package.json)
  • rename the template.env file to .env

Scripts

  • npm start to run app in production mode
  • npm run dev to run app in development mode

Routes

Routes are broken up into two routers and two controller classes.

MainRoutes/MainController

This is pages that render EJS templates. The routes can be registered in server.js using the MainRoutes router and the corresponding function can be defined as a method in the MainController class in the controllers folder.

APIRoutes/APIController

The APIRoutes router handles any requests for urls starting with "/api" meant for routes that are part of JSON APIs, the corresponding function can be defined as a method in the APIController.

For both, look at the examples in the existing code.

Views

An example EJS file making use of the head, header and footer partials already exists, you can use that to copy over to other pages.

  • The head.ejs already has the /static/css/styles.css file and the /static/js/app.js files already configured along with jQuery.

Enjoy!

express-todos-tutorial's People

Contributors

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