Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/couchbaselabs/gameapi-nodejs
Make a simple game server API using NodeJS and Express
https://github.com/couchbaselabs/gameapi-nodejs
Last synced: 1 day ago
JSON representation
Make a simple game server API using NodeJS and Express
- Host: GitHub
- URL: https://github.com/couchbaselabs/gameapi-nodejs
- Owner: couchbaselabs
- Created: 2015-06-22T17:31:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-09-14T21:43:09.000Z (over 4 years ago)
- Last Synced: 2024-04-12T16:19:14.419Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 17
- Watchers: 190
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Game Server API for NodeJS and Couchbase
## Requirements
* NodeJS
* NPM
* Couchbase Server## Instructions
Clone this repository to your desktop or any preferred location.
Using the command prompt (Windows) or Terminal (Mac / Linux) navigate to the cloned directory and run:
```sh
npm install
```This will install all the required application dependencies such as the Couchbase SDK and Express framework.
Open **config.json** at the root of the project and validate that the default global configuration settings look accurate.
When ready to test the application, using the command prompt (Windows) or Terminal (Mac / Linux), run:
```
node app.js
```This will make the application accessible at http://localhost:3000
## API Endpoints
### POST /api/user
Create a new user account on the server
#### Headers
None
#### Parameters
| parameter | description |
|-----------|------------------------------------|
| username | username to access the account |
| password | password for accessing the account |
| name | account owners name |### GET /api/user/me
Get user information about the currently signed in user
#### Headers
| header | description |
|---------------|--------------|
| authorization | bearer token |#### Parameters
None
### GET /api/auth
Trade user credentials for a session id to be used with further requests against protected endpoints
#### Headers
None
#### Parameters
| parameter | description |
|-----------|------------------------------------|
| username | username to access the account |
| password | password for accessing the account |## Project Structure
| file / folder | parent | description |
|-----------------|--------|-----------------------------------------------------|
| routes | root | all application endpoint routes will end up in here |
| routes.js | routes | all endpoint routes |
| models | root | all database classes will end up in here |
| accountmodel.js | models | class for crud operations on user accounts |
| sessionmodel.js | models | class for crud operations on user sessions |
| app.js | root | server initialization code |
| config.json | root | server and database configuration information |## Resources
[Couchbase NodeJS API Reference](http://docs.couchbase.com/sdk-api/couchbase-node-client-2.0.8/)