Skip to content

Repository files navigation

Simple api inspired by Instagram

Versao em pt-BR

Frontend repository

📝 Description

An api made using the MERN stack, which simulates the functioning of Instagram with file uploads and integration with imgur.

📄 Features

  • image upload local and on imgur
  • posts creation
  • posts list
  • posts like

💻 Utilized Stack

  • express.js
  • non relational database mongoDB with mongoose framework and express.js

❓ ​How to use?

  1. Create the files .env.development and .env.production with the needed variables using the example file .env.example
  2. Run yarn install or just yarn for dependencies installation
  3. Run the command yarn dev for development environment and yarn prod for production.

👍 How to contribute?

To contribute with this project create a pull request or an issue and i'l be glad to take a look at them

Roadmap

  • convert all the api to TS
  • create dev server nodemon like command
  • remove tslint and change to eslint because tslint is deprecated
  • add websocket again
  • configure module alias
  • implement tests

📘API Routes

POST localhost:3333/api/posts

var form = new FormData();
form.append("author", "test author");
form.append("place", "test location");
form.append("description", "Test");
form.append("hashtags", "#test #test");
form.append("image", "image binary here");

fetch("http://localhost:3333/api/posts/", {
  method: "POST",
  headers: {
    "content-type": `multipart/form-data; boundary=${form._boundary}`,
  },
})
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });

GET localhost:3333/api/posts

fetch("http://localhost:3333/api/posts", {
  method: "GET",
  headers: {
    "content-type": "application/json",
  },
  body: false,
})
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });

PUT LIKE localhost:3333/api/posts/${id}/like

const id = "id of the post here";
fetch(`http://localhost:3333/api/posts/${id}/like`, {
  method: "PUT",
  headers: {},
})
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages