GithubHelp home page GithubHelp logo

blog-rest-api-dci's Introduction

Blog API

Let’s make our small blog API. The goal of this exercises is to get familiar with setting up an Express && Mongoose project. Here is some step by step instructions.

  • Setup a simple server with Express
  • Setup a database connection with Mongoose
  • Create two data models, one for Users and one for Posts
    • Users -> firstname, lastname, password, username, email
    • Posts -> user_id, title, text, date, image
  • Create CRUD(Create Read Update Delete) endpoints for each of the data models. Please set up your project so you have routes and controllers in different locations.
  • Write a seed script that will fill your db with 20 users and 5 posts per user.

SPOILERS As you can see each post contains a user_id. It’s the id of the user that wrote that post. So, how will you approach the seed script to create 5 posts per user? You would need to get a hold of the ids of the fake users after you create them and pass them to the fake posts.

References

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.