An api made using the MERN stack, which simulates the functioning of Instagram with file uploads and integration with imgur.
- image upload local and on imgur
- posts creation
- posts list
- posts like
- express.js
- non relational database mongoDB with mongoose framework and express.js
- Create the files
.env.developmentand.env.productionwith the needed variables using the example file.env.example - Run
yarn installor justyarnfor dependencies installation - Run the command
yarn devfor development environment andyarn prodfor production.
To contribute with this project create a pull request or an issue and i'l be glad to take a look at them
- 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
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);
});