Skip to content

umershehzad1/ecm

Repository files navigation

ECM Backend Api's

Build Status.

Technologies

ECM uses a number of open source projects to work properly:

Installation

ECM requires Node.js v12+ and MongoDB v4+ to run.

Mongodb Setup

Install MongoDB into your system...

Open Terminal (terminal 1) Run Mongodb

$ mongod

Open Another Terminal (terminal 2) Create new User in Mongodb

$ mongo
> use ecm
> db.createUser( 
    { 
        user: "root",
        pwd: "root",
        roles:
        [ 
            { role: "readWrite", db: "ecm" }
        ] 
    }
)

Close this terminal (terminal 2)

Now Go back to the "mongod" Terminal and press Ctrl + C to stop. It should show the output looks like this. (terminal 1)

$ mongod // press Ctrl + C to stop process
2018-10-24T15:54:16.868+0500 I CONTROL  [initandlisten] MongoDB starting : pid=11376 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-PH3E1MA
.....................................................................

.....................................................................
2018-10-24T15:54:19.107+0500 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2018-10-24T15:54:19.107+0500 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2018-10-24T15:54:19.134+0500 I NETWORK  [initandlisten] waiting for connections on port 27017
^C

And Now Run mongodb with authentication (terminal 1)

$ mongod --auth
................................................................................
torage engine, so setting the active storage engine to 'wiredTiger'.
2018-10-24T15:56:03.352+0500 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2018-10-24T15:56:06.092+0500 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2018-10-24T15:56:06.092+0500 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2018-10-24T15:56:06.096+0500 I NETWORK  [initandlisten] waiting for connections on port 27017

If mongodb runs successfully then go the next step

Clone Repository

$ git clone https://github.com/NarsunOrg/{project}

Install the dependencies and devDependencies and start the server.

$ cd ecm
$ npm install -d
$ npm run

output:

$ node server
> Connecting to database...
Connected to database...
Server Running on port 3000

.ENV Config file

Simply rename the .env-example file to .env in the project folder

$ mv .env-example .env

You can customize your changes as you want by changing .env file in the project folder

Swagger Api's Documentation

Name EndPoint
Docs http://localhost:3000/docs

Docs Endpoint:

METHOD: GET

Return:

return api's documentation page

Sockets Emit/listener Documentation

Name EndPoint
Docs https://docs.google.com/document/d/1zLmRIfX8Yzn_z5EM2bdkJlbnxc7ZWSzGUVWq4GIH2vA/edit?usp=sharing

Test Game (Sockets)

Name EndPoint
game http://localhost:3000/web/game

Test Game Endpoint:

METHOD: GET

Return:

return Test game web page

Development

ECM uses Gulp for fast development. Make a change in your file and instantanously see your updates!

Open your favorite Terminal and run these commands.

Install Gulp globally

$ npm install --global gulp

Run Gulp in the ecm project ecm:

$ gulp

Test Unit

$ npm test

Verify the deployment by navigating to your server address in your preferred browser.

127.0.0.1:3000

i.e

127.0.0.1:3000/api/v1/Users

Todos

License

MIT

Developed by Umer Ahmad Shahzad

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published