Coder Social home page Coder Social logo

mmoserver's Introduction

PixelStreaming MMO API

Installation

$ npm install

Start postgresql locally and set up db

> brew services start postgresql
> psql postgres

postgres=# create role ProjectName with password '123456';
CREATE ROLE
postgres=# alter role ProjectName login superuser inherit createdb createrole replication;
ALTER ROLE
postgres=# create database ProjectName;
CREATE DATABASE
postgres=# grant all privileges on database ProjectName to ProjectName;
GRANT
postgres=# grant all privileges on all tables in schema public to ProjectName;
GRANT
postgres=# \q

or download postgresql app
https://www.postgresql.org/download/
setup the login user
Add the new database

change the .env file
DATABASE_USER=<db user name>
DATABASE_PASSWORD=<db password>
DATABASE_NAME=<dbname>
DATABASE_HOST=<host url>

Alternative Postgres run with Docker

If you are familiar with docker and you don't want to install postgres, you can use docker-compose to spin up the database. Simply run the following:

docker-compose up

# optional: to view the database data
# go to http://localhost:8098
# select system = db, username = postgres,
# password = 123456, database = dbname

Prepare terminal with environment variables

# make a copy of environment variables
$ cp .env.sample .env

# edit .env with an editor, eg vim
$ vim .env

# add to environment
$ source .env

Edit values to reflect local configuration environment

Run migrations

$ npm run migrate:up

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

View API docs at http://localhost:3001/api or download json for import into postman with http://localhost:3001/api-json

Deploy your application to Heroku

$ git add .
$ git commit -am "commit"
$ git push heroku main

pm2 serve

$ pm2 start dist/main.js --name <application_name>
$ pm2 startup systemd
$ pm2 save

mmoserver's People

Contributors

cocotopdev avatar

Watchers

Tobias Chen 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.