Skip to content
Permalink
Browse files

initial commit

  • Loading branch information...
minamorl committed Jun 29, 2016
0 parents commit b53dc0a720f8fd931c765080c65d147e6e85d464
@@ -0,0 +1,41 @@

# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
@@ -0,0 +1,19 @@
"use strict";
const ws_1 = require("ws");
const Sequelize = require("sequelize");
// define models
let sequelize = new Sequelize('sample', '', '', { dialect: 'sqlite', storage: './sample.db' });
let Message = sequelize.define('message', {
text: Sequelize.STRING,
});
Message.sync();
let wss = new ws_1.Server({ port: 8080 });
wss.on('connection', (ws) => {
ws.send("starting connection");
ws.on('message', (message) => {
ws.send("received:" + message);
Message.create({ text: message }).then(() => {
ws.send("saved");
});
});
});
@@ -0,0 +1,22 @@
{
"name": "respass",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"scripts": {
"compile:ts": "tsc",
"start": "npm run compile:ts && node ./lib/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "minamorl",
"license": "ISC",
"devDependencies": {
"typescript": "^1.8.10"
},
"dependencies": {
"http": "0.0.0",
"sequelize": "^3.23.4",
"sqlite3": "^3.1.4",
"ws": "^1.1.1"
}
}
@@ -0,0 +1,22 @@
import { Server } from "ws"
import Sequelize = require("sequelize")

// define models
let sequelize = new Sequelize('sample','','',{dialect:'sqlite',storage:'./sample.db'})
let Message = sequelize.define('message', {
text: Sequelize.STRING,
});
Message.sync()


let wss = new Server({port: 8080})
wss.on('connection', (ws) => {
ws.send("starting connection")
ws.on('message', (message) => {
ws.send("received:" + message )
Message.create({text: message}).then(() => {
ws.send("saved" )
})
})
})

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"sourceMap": false,
"outDir": "./lib"
},
"files": [
"./typings/index.d.ts",
"./src/index.ts"
],
"exclude": [
"node_modules"
]
}
@@ -0,0 +1,12 @@
{
"name": "respass",
"dependencies": {
"sequelize": "registry:npm/sequelize#3.0.0+20160604152601"
},
"globalDependencies": {
"node": "registry:dt/node#6.0.0+20160621231320",
"sequelize": "registry:dt/sequelize#3.4.1+20160622054214",
"socket.io": "registry:dt/socket.io#1.4.4+20160317120654",
"ws": "registry:dt/ws#0.0.0+20160405094435"
}
}
Oops, something went wrong.

0 comments on commit b53dc0a

Please sign in to comment.
You can’t perform that action at this time.