Code Monkey home page Code Monkey logo

buildinganapi's Introduction

REQUIRED

  • Setup an API with a project structure like:
/client
--/server
----/routes
------index.js
------chirps.js
----server.js
----chirpsstore.js (file provided in this lab)
  • In routes/chirps.js, create GET, POST, PUT, DELETE methods on a router that is created in chirps.js.
    • Import chirpsstore, and use it to read and write chirps to the json file.
      • The json file will be created the first time you run successfully!
      • Remember to export your router with module.exports.
  • In routes/index.js, import the chirps router and add it to a new router.
    • Use app.use with the /chirps route to add to the root api router.
    • Export the router.
  • In server.js, import the routes folder (./routes).
    • Add the api router to the express app with the path /api.
  • Test all of your methods using Postman (https://www.getpostman.com/)

ADVANCED

  • Create an index.html, styles.css, and app.js file in the client folder.
    • Code an app that uses jQuery to call your API and displays chirps.
      • Create a form that lets you create new chirps
        • Do not use a form submit (you only need the inputs and not necessarily a form!)
        • Use a button click event to call the API.
      • Add an x next to each chirp that will delete the chirp when clicked.
      • When a chirp is clicked, popup a modal that lets you edit the chirp.
  • Remember to use express.static middleware!
  • HINT: jQuery functions for calling APIs: $.ajax, $.get, $.post

buildinganapi's People

Contributors

atlc avatar

Watchers

 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.