[go: nahoru, domu]

Skip to content

Coo Homeless API - The API Server for the mobile app Coo Homeless

Notifications You must be signed in to change notification settings

tiaghoalves/coo-homeless-api

Repository files navigation

Coo Homeless Page

GitHub license npm version Build Status dependencies Status devDependencies Status

REST API Server

The project is generated by LoopBack.

Wiki

Please before decided to contribute to this project, take a look at the Wiki to see important guides.

Installing

First, download the repository or make the git clone in a directory:

git clone git@github.com:tiaghoalves/coo-homeless-api.git

Then to go the folder and install all the dependencies with:

npm install

Maybe npm will need some permissions to install all packages, so run with sudo or other equivalent command depends on your OS.

Start up enviroment

A loopback project uses the server/datasourcers.json file to do the database connection and store other important configuration, see the docs. The datasource need to be configured with your own properties values. The current file you find here.

As you can see, here we're using two ways to persist data between the server API and databases. Actually, there's a in memory database named db, which is a default option to store models and things that doesnt need to be in database. You may not change that to do alteration in the src.

The second json property, is what matters for you to change because here is the database connection. According to work with MySQL database and using the loopback-connector-mysql module that provides connection to MySQL database.

As well change the values your own, dont forget to setting up the database(creating database script). The loopback-connector-mysql introduces the default entry in a datasources.json as like that:

"mydb": {
    "name": "mydb",
    "connector": "mysql",
    "host": "myserver",
    "port": 3306,
    "database": "mydb",
    "password": "mypassword",
    "user": "admin"
}

Follow this to add your properties.

Build and run

Actually, the project is using nodemon in dev enviroment just for reloading server automatically for us and Babel for transpilation to work with ES6. We are using babel-node which works the same as babel-cli but for node, so we start the project in npm start with nodemon --exec babel-node .

To start the server:

npm start

If doesnt work for you, just start with node . but if you will change the code constantly, it will be cool install nodemon to made this in dev mode, for instalation:

npm install -g nodemon

So run the nodemon in the project folder:

nodemon .

While running the loopback explorer interface for the server can be access in: http://localhost:3000/explorer/

About

Coo Homeless API - The API Server for the mobile app Coo Homeless

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •