Git Product home page Git Product logo

jitendragangwar123 / rest-api-for-nfts Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 9.15 MB

To develop a REST API for an NFT marketplace, you can use Node.js for the backend server and MongoDB as the database. This API will facilitate various operations related to NFTs, such as creating, listing, buying, and transferring non-fungible tokens on the marketplace.

JavaScript 100.00%
ethereum-api javascript mongodb nfts nodejs

rest-api-for-nfts's Introduction

Rest-API-For-NFT

To build the Rest-API for NFT Marketplace using NodeJs and MongoDB.

$ npm init 
$ npm i express@4 
$ sudo npm install -g nodemon 
* JSON.parse() method used to convert the json file to object
* get status: 200 (OK)
* post status: 201 (created)
* Error status: 404 (Not Found)
* Null status: 202 (No content)
* Internal Server Error: 500 
* Missing Params: 400 (bad request)
* Express Middleware :- Which allow us to read the data from the user(postman body) and write our document.
  app.use(express.json());
//to convert the id into int
  const id=parseInt(req.params.id);
  or
  const id= req.params.id *1; 
patch method :- Update the only desired value from the database.
put method :- Update the whole database 
delete method :- Delete the whole database
* Custom middleware : Every time it will be execute whenever any request will be send.
* morgan : used as a middleware to identify the request.
  $ npm i morgan
* Install morgan only for developemnt env
  $ npm i morgan --save-dev  
MVC Model: Model-Veiw-Controller
Serving Template: Access the static files using express
app.use(express.static(`${__dirname}/nft-data/img`));
.env file :
  $ npm i dotenv
// To start the application in development environment
  $ npm start
// To start the application in production environment
  $ npm run start:prod   
* MongoDB Connection :
  $ npm install mongodb
  $ npm i [email protected]
* Remove the folders and files from git
  $ git rm -r "folder name"
  $ git rm "file name"
* Add the config files in .gitigone file

  $ echo ".env" >> .gitignore
  $ git rm --cached .env
  $ git add .gitignore

rest-api-for-nfts's People

Contributors

daulathussain avatar jitendragangwar123 avatar

Stargazers

 avatar

Watchers

 avatar  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.