follow-the-nft / follow-the-nft-api

The Express API for the follow-the-nft
MIT License
0 stars 0 forks source link

Checks codecov Contributors Forks Stargazers Issues MIT License


@Follow The NFT

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contributing
  4. License
  5. Contact
  6. Acknowledgments

About The Project

An Application secured by Auth that allows the users to search through NFT's using OpenSea API, and save their favorite NFT or artist.

UML

Built With

Getting Started

# Install NPM
npm install npm@latest -g

# Clone the repository
git clone git@github.com:follow-the-nft/follow-the-nft-api.git

# Dev Database setup
psql
CREATE DATABASE "follow-the-nft";
\q

# Install dependencies
npm install

# Running locally
npm run dev

# Running tests
npm run test

Optional for using in Production Environment

Request API Key from Opensea

API is free to use on lmited basis. To use the API in a production environment, request key from URL above. Enter email address, project name, project description, and a link to the project website. Approval takes 1-2 days.

Use API key in the header of request.

INSTALLATION
npm install axios --save

REQUEST
import axios from "axios";

const options = {
  method: 'GET',
  url: 'https://api.opensea.io/api/v1/asset/0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb/1/',
  headers: {'X-API-KEY': 'apiKeyHere'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

Usage

Our application is a backend application. We recommend using Postman to hit our routes.

Heroku Deployment

Heroku Deployment

Public Routes

Get: NFT by Token and Address

http://localhost:3001/<address>/<token_id>

This will return back a NFT 

Get: NFT by Address

http://localhost:3001/address/<address>

Will return back wallet address 

http://localhost:3001/addresses/<addresses>

Will return back wallet addresses by how many address you add

Get: Collection by Slug

http://localhost:3001/collection/<slug>

Will return back a collection based on the slug passed in

Auth Routes

Post: Register your account

http://localhost:3001/register

Pass in your desired username, password

ex.

{
  "username": "testUserName",
  "password": "testPassword",
}

### Post: NFT you like

http://localhost:3001/likes/

/

This will save your liked NFT to the database in an array format

If you post the same address and token_id, it will remove the liked NFT from the database


### Get: Your NFT you have liked

http://localhost:3001/likes

This will return back your NFT assets in an array format


### Post: NFT you want to follow

http://localhost:3001/follows/

This will save the wallet of the address to the database in an array format

If you post the same address, it will remove the followed NFT from the database


### Get: Your NFT you have followed

http://localhost:3001/follows

This will return back your NFT wallet in an array format


<!-- ROADMAP 
## Roadmap

- [] Feature 1
- [] Feature 2
- [] Feature 3
    - [] Nested Feature
-->

See the [open issues](https://github.com/follow-the-nft/follow-the-nft-api/issues) for a full list of proposed features (and known issues).

## Testing

This repository is tested using [jest](https://jestjs.io/). An example test can be seen below.

```JavaScript
'use strict'

const supertest = require('supertest')
const server = require('./server')
const request = supertest(server.server)

describe('Given /', () => {
  describe('When GET', () => {
    it('Then returns 200 status', async () => {
      const response = await request.get('/')
      expect(response.status).toEqual(200)
    })

    it('Then returns correct response body', async () => {
      const response = await request.get('/')
      expect(response.text).toEqual('@FollowTheNFT')
    })
  })
})

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Heather Bisgaard - @vbchomp - vbchomp@gmail.com
Charlie Fadness - @fadnesscharlie - fadness.charlie@hotmail.com
Tom McGuire - @MuckT - mcgtom10@gmail.com
Jeremy Brazell - @Jeremywbrazell - jwbrazell@gmail.com

Project Link: https://github.com/follow-the-nft/follow-the-nft-api

Acknowledgments

(back to top)