Skip to content

API for image uploading with Node, Express, Multer and MongoDb.

Notifications You must be signed in to change notification settings

sucodelarangela/uploadimg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uploadimg!

Read it in English

O Uploadimg foi um pequeno projeto para teste de upload de imagens que usa MongoDb e Node.js para salvar os dados em banco de dados e em disco utilizando o Multer.

⚙️ Como usar

  1. Crie um banco de dados no MongoDb Atlas;

  2. Faça o download deste repositório através do botão verde Code no topo da página e, em seguida, clicando em Download ZIP. Ou, se preferir, através do terminal (Git Bash, Powershell, etc.), use o comando:

git clone https://github.com/sucodelarangela/uploadimg.git
  1. Acesse a pasta do projeto com seu terminal;

  2. Rode o comando npm install ou yarn install para instalar as dependências (você precisa ter o Node.js instalado);

  3. Renomeie o arquivo .env.example para apenas .env. Neste arquivo, substitua os valores das variáveis pela porta de sua preferência para o localhost, além do nome de usuário e senha do seu banco de dados do MongoDb Atlas criado no passo 1.

A aplicação só funcionará com esses dados corretamente inseridos no arquivo .env.

  1. Após a correta configuração acima, rode a aplicação com o comando npm start ou yarn start. Você deve receber a seguinte mensagem de confirmação:
[nodemon] starting `node ./app.js`
Server running on port <porta>
Database successfully connected!
  1. Para simular as rotas no lado do cliente, você pode usar a extensão Thunder Client para o VS Code.

GET: http://localhost:${port}/pictures

POST: http://localhost:${port}/pictures

DELETE: http://localhost:${port}/pictures/:id

🔼 Voltar ao topo


English version

🔎 Overview

Uploadimg is a small project for testing image uploads using MongoDb and Node.js to save data in a database and locally using Multer.

⚙️ How to use it

  1. Create a database in MongoDb Atlas;

  2. Download this repository by clicking the green Code button on top of the page and then clicking Download ZIP option. Or use the following command on your terminal (Git Bash, Powershell, etc.):

git clone https://github.com/sucodelarangela/uploadimg.git
  1. Access the project root folder on your terminal;

  2. Run npm install or yarn install to install all project dependencies (you must have Node.js installed);

  3. Rename the .env.example file to only .env. In this file, replace the values for the variables with your favorite localhost port, the user name and password for the MongoDb Atlas database created on step 1.

The app will only work properly if these data are correctly set in .env file.

  1. To start the application, run npm start or yarn start on yout terminal. You should receive the following message:
[nodemon] starting `node ./app.js`
Server running on port <porta>
Database successfully connected!
  1. To simulate the routes on client side, you can use the VS Code extension Thunder Client.

GET: http://localhost:${port}/pictures

POST: http://localhost:${port}/pictures

DELETE: http://localhost:${port}/pictures/:id

🔼 Back to top


Developed with 🧡 by @sucodelarangela

About

API for image uploading with Node, Express, Multer and MongoDb.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published