Add some doc
This commit is contained in:
parent
f30d000f92
commit
ad6cc13681
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Phyks (Lucas Verney)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
82
README.md
82
README.md
@ -1,28 +1,82 @@
|
||||
# cyclassist
|
||||
Cyclassist
|
||||
==========
|
||||
|
||||
> A Vue.js project
|
||||
> Track and share issues (work, interruption in routes, parked cars) in
|
||||
> realtime on bike lanes!
|
||||
|
||||
## Build Setup
|
||||
This app is made of two parts: a client webapp and a server part to store and
|
||||
serve the issues.
|
||||
|
||||
## Client part
|
||||
|
||||
### Build setup
|
||||
|
||||
``` bash
|
||||
# install dependencies
|
||||
npm install
|
||||
# Install JS dependencies
|
||||
yarn install
|
||||
|
||||
# serve with hot reload at localhost:8080
|
||||
npm run dev
|
||||
# Serve with hot reload at localhost:8080
|
||||
yarn dev
|
||||
|
||||
# build for production with minification
|
||||
npm run build
|
||||
# Build for production with minification
|
||||
yarn build
|
||||
|
||||
# build for production and view the bundle analyzer report
|
||||
npm run build --report
|
||||
# Build for production and view the bundle analyzer report
|
||||
yarn build --report
|
||||
```
|
||||
|
||||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
||||
### Useful environment variables
|
||||
|
||||
You can pass a few environment variables to the `yarn build|dev` commands to
|
||||
adapt the behavior to your needs.
|
||||
|
||||
* `PUBLIC_PATH=https://.../foobar` to serve the app from a subdirectory.
|
||||
* `API_BASE_URL=https://...` to specify the location of the server (defaults
|
||||
to `/`). The value should end with a trailing slash.
|
||||
|
||||
|
||||
## Serving from a subdirectory
|
||||
## Server part
|
||||
|
||||
### Build setup
|
||||
|
||||
``` bash
|
||||
# Install Python dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Start the server
|
||||
python -m server
|
||||
```
|
||||
|
||||
It is better to use a dedicated `virtualenv` if you can :)
|
||||
|
||||
### Useful environment variables
|
||||
|
||||
You can pass a few environment variables to the `python -m server` command to
|
||||
adapt its behavior:
|
||||
|
||||
* `HOST=` to specify the host to listen to (defaults to `127.0.0.1` which
|
||||
means `localhost` only).
|
||||
* `PORT=` to specify the port to listen on (defaults to `8081`).
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
The quickest way to get started is to simply run
|
||||
|
||||
```
|
||||
PUBLIC_PATH=https://.../foobar yarn build
|
||||
API_BASE_URL=http://127.0.0.1:8081/ yarn dev
|
||||
```
|
||||
|
||||
to spawn the client-side webapp, listening on `localhost:8080` and
|
||||
|
||||
```
|
||||
python -m server
|
||||
```
|
||||
|
||||
to spawn the server-side part, listening on `localhost:8081`.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This software is licensed under an MIT license, unless explicitly mentionned
|
||||
otherwise.
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
API_BASE_URL: JSON.stringify(process.env.API_BASE_URL),
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
# coding: utf-8
|
||||
import functools
|
||||
import json
|
||||
import os
|
||||
|
||||
import bottle
|
||||
|
||||
@ -21,4 +22,7 @@ if __name__ == "__main__":
|
||||
json_dumps=functools.partial(json.dumps, cls=DateAwareJSONEncoder)
|
||||
)
|
||||
)
|
||||
bottle.run(host='0.0.0.0', port='8081')
|
||||
bottle.run(
|
||||
host=os.environ.get('HOST', '127.0.0.1'),
|
||||
port=int(os.environ.get('PORT', '8081'))
|
||||
)
|
||||
|
@ -2,7 +2,7 @@ require('es6-promise').polyfill();
|
||||
require('isomorphic-fetch');
|
||||
|
||||
// With trailing slash
|
||||
export const BASE_URL = process.env.API_BASE_URL || 'http://127.0.0.1:8081/'; // TODO
|
||||
export const BASE_URL = process.env.API_BASE_URL || '/';
|
||||
|
||||
export function saveReport(type, lat, lng) {
|
||||
return fetch(`${BASE_URL}api/v1/reports`, {
|
||||
|
Loading…
Reference in New Issue
Block a user