Coder Social home page Coder Social logo

blog-api's Introduction

Blog-api

The idea of this project is taken from Blog-API of The Odin Project.

My goal in this project was to practice authentication with Passport-jwt strategy, learn how to implement CRUD operations with GraphQL, and build my first api.

The technologies I used:

To know how to use it and read about features, please visit this file.

How to run

To run this api and see if it works well, you need to take a few steps.

First, you need to download and install Node.js.

Second, you need to have a MongoDB database so the app can connect to it. You can get a free tier of MongoDB Atlas. There's a guide here.

Third, you need an AWS S3 storage. I myself used Arvan Cloud storage service (for ease).

For the last part, you need to clone this repo. Go to any directory you want in your computer. Then, open the terminal and write the command below (I assume you already have Git installed):

git clone https://github.com/mahdiHash/blog-api.git

After that:

cd blog-api

Now you need to create a .env file in the root directory. This file is needed so the app can read the database URI, online storage service required information and JWT secret key from environment variables. Here's the list of variables you need to create:

  • S3_SECRET_KEY: your online storage service secret key,
  • ACCESS_KEY: your online storage service access key,
  • BUCKET: your online storage service bucket name,
  • ENDPOINT: your online storage service endpoint,
  • TOKEN_SECRET: a secret code that will be used by passport-jwt configuration,
  • MONGODB: your mongodb URI.

After these steps, you need to install the dependencies. For that, you can write npm install in the terminal. This will install all the dependencies the project needs.

Now to run a local server, enter npm run start (you can also write npm run devstart to use nodemon). After starting the server, you can send requests anyhow you're comfortable with (e.g. Postman) and get the response. The base URI is http://127.0.0.1:3000 or http://localhost:3000.

blog-api's People

Contributors

mahdihash avatar

Watchers

 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.