Giter VIP home page Giter VIP logo

diy-api-with-views's Introduction

DIY API... now with ejs!

Overview

Your mission is to add views onto a diy-api. The end product will be a server that serves html files instead of json data, so that we can interact with it via a web browser like chrome rather than postman.

This repo contains the working diy-api that we made as we reviewed the deliverable. This will be our starter code.

Getting Set Up

  1. Fork and clone this repo
  2. npm install
  3. If you're on linux or windows, add your db username and password to config/config.json
  4. sequelize db:create, sequelize db:migrate, sequelize db:seed:all
  5. Start the server and interact with each endpoint via postman to make sure everything works

Setting up ejs

  1. Install the packages ejs, express-ejs-layouts, & method-override
  2. In your middleware section of server.js: set your view engine, serve static files, use layouts, and use methodOverride
  3. Make a views directory, containing a layout.ejs, and a subfolder for each database table

Core goals

  1. The GET /countries (index) and GET /countries/:id (show) routes should render a ejs view file instead of json.
  2. Each country name in the countries index page should be a link to that country's show page.
  3. The countries index page should have a link to the form to make a new country. This link hits a GET /countries/new route, which renders the form. This form should create a new country when submitted.
  4. Each country's show page should include a form to edit that country, as well as a button to delete it.

Stretch goals

  1. Add a continents index route that shows all existing continents. The countries index and the continents index should link to each other to ease user navigation.
  2. Each continent's name on the continents index should link to that continent's show page.
  3. The continent's show page should have the same functionality as the country's show page, plus the following functionality:
  4. The continent's show page should have a link to a list of all countries in that continent. (This route already exists, but it needs to change so that it renders an ejs file instead of json.)
  5. The continent's show page should have a link to a form that will create a new country within that continent. This link should hit the route GET /continents/:id/countries/new, and that route should render the form. You may need a hidden input for this!

diy-api-with-views's People

Contributors

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