Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.
/ sample-sync-rest Public archive

⚠️Right after we made this the API for Decentraland changed so this wont work anymore. See -> https://decentraland.org/

Notifications You must be signed in to change notification settings

tcrowe/sample-sync-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ The API for Decentraland changed so this will not work as-is. Maybe we can upgrade it soon. New API and info is at -> https://decentraland.org/

sample-sync-rest

It's a Decentraland scene to demonstrate how to incorporate an HTTP-REST API.

blank

shapes

success

Docs

REST functions

  • GET /api/pixels
    • get all pixels
  • GET /api/pixels/pixel/?x=6&y=4
    • get a single pixel at {x,y} coordinate from db
  • PUT /api/pixels/pixel
    • put a new pixel into the db
  • POST /api/pixels/pixel/:id
    • post an existing pixel back into the db
  • DELETE /api/pixels/pixel/:id
    • delete existing pixel

Install

It uses MongoDB so please Install MongoDB before continuing.

# clone to your machine
git clone https://github.com/tcrowe/sample-sync-rest.git
cd sample-sync-rest

Run the scene preview

# from the project root
cd scene

# install node dependencies
npm install

# start the preview
npm start

Run the REST server

(In another terminal window)

# from the project root
cd server

# install node dependencies
npm install

# start the server
npm start

Database

Running the server and clicking around in the scene should automatically create the database.

You can confirm what is in the database by running:

mongodb

use sample-sync-rest
# switched to db sample-sync-rest

# list all pixels
db.pixels.find()

# ⚠️ delete all pixels
db.pixels.remove({})

Contribute

If you notice that I've made an affront to correct TypeScript coding practices please forgive.

Others will want to use this as an example or starting place to fork from. If you see room for improvement please fork, mod, and send back here in a PR.

Thank you! 🤗

About

⚠️Right after we made this the API for Decentraland changed so this wont work anymore. See -> https://decentraland.org/

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published