Skip to content

Commit

Permalink
style: restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasCao committed Mar 8, 2019
1 parent c2d6a1f commit 926e707
Show file tree
Hide file tree
Showing 9 changed files with 15,219 additions and 9,450 deletions.
40 changes: 20 additions & 20 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
const Koa = require("koa"),
koaRouter = require("koa-router"),
json = require("koa-json"),
logger = require("koa-logger"),
api = require("./server/routes/api.js");
admin = require("./server/routes/admin.js");
jwt = require("koa-jwt"),
config =require("./server/config"),
mongoose =require("mongoose"),
path =require("path"),
serve = require("koa-static");
historyApiFallback = require("koa2-history-api-fallback");
const Koa = require('koa'),
koaRouter = require('koa-router'),
json = require('koa-json'),
logger = require('koa-logger'),
api = require('./server/routes/api.js');
admin = require('./server/routes/admin.js');
jwt = require('koa-jwt'),
config =require('./server/config'),
mongoose =require('mongoose'),
path =require('path'),
serve = require('koa-static');
historyApiFallback = require('koa2-history-api-fallback');


mongoose.connect(config.mongodb.url, config.mongodbSecret);
mongoose.connection.on("error", console.error);
mongoose.connection.on("open", () => console.log("MongoDB connection successed"));
mongoose.connection.on('error', console.error);
mongoose.connection.on('open', () => console.log('MongoDB connection successed'));

const app = new Koa(),
router = koaRouter()

app.use(require("koa-bodyparser")());
app.use(require('koa-bodyparser')());
app.use(json());
app.use(logger());


app.on("error", function(err, ctx){
console.log("server error", err);
app.on('error', function(err, ctx){
console.log('server error', err);
});

router.use("/api",api.routes())
router.use("/admin",jwt({secret: config.jwt.secret}).unless({ path: [/^\/admin\/login/]}),admin.routes())
router.use('/api',api.routes())
router.use('/admin',jwt({secret: config.jwt.secret}).unless({ path: [/^\/admin\/login/]}),admin.routes())
app.use(router.routes());


Expand All @@ -39,7 +39,7 @@ app.use(router.routes());
// app.use(serve(path.resolve('dist')));

app.listen(3389,() => {
console.log("Koa is listening in 3389");
console.log('Koa is listening in 3389');
});


Expand Down
Loading

0 comments on commit 926e707

Please sign in to comment.