suroh
1 year ago
17 changed files with 5413 additions and 8017 deletions
@ -1,31 +0,0 @@ |
|||||
# ethermap api |
|
||||
|
|
||||
Backend for ethermap |
|
||||
|
|
||||
## Install |
|
||||
|
|
||||
To install and run the backen you will need [NodeJS](https://nodejs.org/en) and `npm` installed, along with access to Postgresql server (possibility for this to be any database server). Then : |
|
||||
|
|
||||
```sh |
|
||||
$ npm i |
|
||||
``` |
|
||||
|
|
||||
Once all the packages are installed you should setup your `.env` file (follow the `.env.template`). Once this has all the appropriate entries you can then connect and migrate the database. |
|
||||
|
|
||||
```sh |
|
||||
$ npm run migrate:latest |
|
||||
``` |
|
||||
|
|
||||
then to run the development server you should run : |
|
||||
|
|
||||
```sh |
|
||||
$ npm run dev |
|
||||
``` |
|
||||
|
|
||||
## Tech |
|
||||
|
|
||||
The backend is made up of a REST api and websocket server. The REST api is built on [Express](https://expressjs.com/) and the websocket server is built on [socket.io](https://socket.io/). |
|
||||
|
|
||||
Database interface is the ODM [objection.js](https://vincit.github.io/objection.js/). This setup might not be the best as it was adopted mid-project after starting with just [Knex](https://knexjs.org/) alone. |
|
||||
|
|
||||
Tests are written in [Ava](https://github.com/avajs/ava). |
|
File diff suppressed because it is too large
@ -1,39 +0,0 @@ |
|||||
{ |
|
||||
"name": "ethermap", |
|
||||
"version": "0.0.1", |
|
||||
"description": "collaborative map tool inspired by etherpad", |
|
||||
"main": "index.js", |
|
||||
"type": "module", |
|
||||
"scripts": { |
|
||||
"dev": "nodemon index.js", |
|
||||
"test": "ava", |
|
||||
"test:routes": "ava ./tests/routes.js", |
|
||||
"test:db": "ava ./tests/db.js", |
|
||||
"migrate:latest": "knex migrate:latest", |
|
||||
"migrate:drop": "knex migrate:down" |
|
||||
}, |
|
||||
"keywords": [ |
|
||||
"ethermap", |
|
||||
"map", |
|
||||
"collaborative" |
|
||||
], |
|
||||
"author": "", |
|
||||
"license": "GPL-3.0-or-later", |
|
||||
"dependencies": { |
|
||||
"cors": "^2.8.5", |
|
||||
"dotenv": "^16.3.1", |
|
||||
"express": "^4.18.2", |
|
||||
"knex": "^2.5.1", |
|
||||
"objection": "^3.1.1", |
|
||||
"pg": "^8.11.3", |
|
||||
"socket.io": "^4.7.2", |
|
||||
"sqlite3": "^5.1.6", |
|
||||
"vite-express": "^0.10.0" |
|
||||
}, |
|
||||
"devDependencies": { |
|
||||
"ava": "^5.3.1", |
|
||||
"eslint": "^8.48.0", |
|
||||
"nodemon": "^3.0.1", |
|
||||
"supertest": "^6.3.3" |
|
||||
} |
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
# ethermap frontend |
|
||||
|
|
||||
Frontend for ethermap |
|
||||
|
|
||||
## Install |
|
||||
|
|
||||
To install the frontend you will need [NodeJS](https://nodejs.org/en) and `npm` installed. Then : |
|
||||
|
|
||||
```sh |
|
||||
$ npm i |
|
||||
``` |
|
||||
|
|
||||
To run the development server run : |
|
||||
|
|
||||
```sh |
|
||||
$ npm run dev |
|
||||
``` |
|
||||
|
|
||||
## Tech |
|
||||
|
|
||||
The interface is built with [LitElement](https://lit.dev/) and setup with [Vite](https://vitejs.dev/) bundler and dev server. |
|
||||
|
|
||||
Maps are rendered with [Leaflet](https://leafletjs.com). |
|
||||
|
|
||||
For ethermap to work you will also need to be running the [ethermap.api]() server for REST API and Socket.io connectivity. |
|
File diff suppressed because it is too large
@ -1,22 +0,0 @@ |
|||||
{ |
|
||||
"name": "ethermap.front", |
|
||||
"private": true, |
|
||||
"version": "0.0.0", |
|
||||
"type": "module", |
|
||||
"scripts": { |
|
||||
"dev": "vite", |
|
||||
"build": "vite build", |
|
||||
"preview": "vite preview" |
|
||||
}, |
|
||||
"devDependencies": { |
|
||||
"eslint-plugin-lit": "^1.9.1", |
|
||||
"vite": "^4.4.5" |
|
||||
}, |
|
||||
"dependencies": { |
|
||||
"leaflet": "^1.9.4", |
|
||||
"leaflet-contextmenu": "^1.4.0", |
|
||||
"lit": "^2.8.0", |
|
||||
"socket.io-client": "^4.7.2" |
|
||||
}, |
|
||||
"license": "GPL-3.0-or-later" |
|
||||
} |
|
File diff suppressed because it is too large
@ -1,17 +1,18 @@ |
|||||
import App from './express.js' |
import App from './backend/express.js' |
||||
|
import ViteExpress from 'vite-express' |
||||
import 'dotenv/config' |
import 'dotenv/config' |
||||
|
|
||||
import { Socket } from './sockets.js' |
import { Socket } from './backend/sockets.js' |
||||
import { Server } from 'socket.io' |
import { Server } from 'socket.io' |
||||
|
|
||||
|
|
||||
const server = App.listen(process.env.PORT, () => { |
const server = App.listen(process.env.PORT, () => { |
||||
console.log(`Ethermap listening for connections on port ${process.env.PORT}`) |
console.log(`Ethermap listening for connections on port ${process.env.PORT}`) |
||||
}) |
}) |
||||
|
|
||||
const io = new Server(server, { |
const io = new Server(server) |
||||
cors: { |
|
||||
origin: 'http://localhost:5173' |
ViteExpress.bind(App, server) |
||||
} |
|
||||
}) |
|
||||
|
|
||||
Socket(io) |
Socket(io) |
||||
|
|
@ -1,6 +1,7 @@ |
|||||
import { defineConfig } from 'vite' |
import { defineConfig } from 'vite' |
||||
|
|
||||
export default defineConfig({ |
export default defineConfig({ |
||||
|
root: 'frontend/', |
||||
base: '/', |
base: '/', |
||||
build: { |
build: { |
||||
sourcemap: true, |
sourcemap: true, |
Loading…
Reference in new issue