Skip to content
Snippets Groups Projects
Commit 3bc3c3bb authored by junyoungjeon's avatar junyoungjeon
Browse files

Initial commit

parents
Branches master
No related tags found
No related merge requests found
Pipeline #5006 failed
Showing
with 516 additions and 0 deletions
.DS_Store 0 → 100644
File added
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var cors = require('cors');
var session = require('express-session');
var FileStore = require('session-file-store')(session)
const mongoose = require('mongoose');
const mongooseAutoInc = require('mongoose-auto-increment');
conn = mongoose.connect('mongodb://localhost:27017/201402937', {
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true,
});
mongooseAutoInc.initialize(mongoose.connection);
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var authRouter = require('./routes/auth');
var app = express();
app.use(cors());
app.use(cookieParser('secret code'));
app.use(session({
resave: false,
saveUninitialized: false,
secret: 'secret code',
store : new FileStore()
})
);
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({extended: false}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/auth', authRouter);
app.get('/', (req, res, next) => { // 3
console.log(req.session);
if (!req.session.num) {
req.session.num = 1;
} else {
req.session.num = req.session.num + 1;
}
res.send(`Number : ${req.session.num}`);
});
// catch 404 and forward to error handler
app.use(function (req, res, next) {
next(createError(404));
});
// error handler
app.use(function (err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
module.exports = app;
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('backend:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
const {Schema, model} = require('mongoose');
const mongooseAutoInc = require('mongoose-auto-increment');
const userSchema = new Schema({
username: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
height: Number,
weight: Number,
myExercise: [
{
exerciseName: {type: String, required: true},
calorie: {type: String, required: true},
}
],
myDiet: [
{
dietName: {type: String, required: true},
calorie: {type: Number, required: true},
gram: {type: Number, required: true}
}
],
date: {type: Date, default: Date.now},
dayInfos: [
{
date: {type: Date,},
exerciseName: {type: String, },
ecalorie: {type: Number, },
dietName: {type: String, },
dcalorie: {type: Number, },
gram: {type: Number, }
}
]
});
userSchema.plugin(mongooseAutoInc.plugin, 'user');
const userModel = model('user', userSchema);
module.exports = userModel;
\ No newline at end of file
../acorn/bin/acorn
\ No newline at end of file
../babylon/bin/babylon.js
\ No newline at end of file
../clean-css/bin/cleancss
\ No newline at end of file
../mime/cli.js
\ No newline at end of file
../semver/bin/semver
\ No newline at end of file
../uglify-js/bin/uglifyjs
\ No newline at end of file
MIT License
Copyright (c) Microsoft Corporation.
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
# Installation
> `npm install --save @types/babel-types`
# Summary
This package contains type definitions for babel-types (https://github.com/babel/babel/tree/master/packages/babel-types).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-types.
### Additional Details
* Last updated: Wed, 02 Sep 2020 15:37:31 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Sam Baxter](https://github.com/baxtersa), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Boris Cherny](https://github.com/bcherny), and [ExE Boss](https://github.com/ExE-Boss).
This diff is collapsed.
{
"_from": "@types/babel-types@^7.0.0",
"_id": "@types/babel-types@7.0.9",
"_inBundle": false,
"_integrity": "sha512-qZLoYeXSTgQuK1h7QQS16hqLGdmqtRmN8w/rl3Au/l5x/zkHx+a4VHrHyBsi1I1vtK2oBHxSzKIu0R5p6spdOA==",
"_location": "/@types/babel-types",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/babel-types@^7.0.0",
"name": "@types/babel-types",
"escapedName": "@types%2fbabel-types",
"scope": "@types",
"rawSpec": "^7.0.0",
"saveSpec": null,
"fetchSpec": "^7.0.0"
},
"_requiredBy": [
"/@types/babylon",
"/constantinople"
],
"_resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.9.tgz",
"_shasum": "01d7b86949f455402a94c788883fe4ba574cad41",
"_spec": "@types/babel-types@^7.0.0",
"_where": "/Users/junyoungjeon/WebstormProjects/mot/backend/node_modules/constantinople",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Troy Gerwien",
"url": "https://github.com/yortus"
},
{
"name": "Sam Baxter",
"url": "https://github.com/baxtersa"
},
{
"name": "Marvin Hagemeister",
"url": "https://github.com/marvinhagemeister"
},
{
"name": "Boris Cherny",
"url": "https://github.com/bcherny"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss"
}
],
"dependencies": {},
"deprecated": false,
"description": "TypeScript definitions for babel-types",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/babel-types",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/babel-types"
},
"scripts": {},
"typeScriptVersion": "3.1",
"types": "index.d.ts",
"typesPublisherContentHash": "0c71c2106ec387ae2bfd63b4429f2e5fe534b5416b903fdf463bae67f92d35a1",
"typesVersions": {
"<=3.6": {
"*": [
"ts3.6/*"
]
}
},
"version": "7.0.9"
}
This diff is collapsed.
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
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
# Installation
> `npm install --save @types/babylon`
# Summary
This package contains type definitions for babylon ( https://github.com/babel/babylon ).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babylon
Additional Details
* Last updated: Wed, 13 Feb 2019 16:16:46 GMT
* Dependencies: @types/babel-types
* Global values: none
# Credits
These definitions were written by Troy Gerwien <https://github.com/yortus>, Marvin Hagemeister <https://github.com/marvinhagemeister>.
// Type definitions for babylon 6.16
// Project: https://github.com/babel/babylon, https://babeljs.io
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { File, Expression } from 'babel-types';
export function parse(code: string, opts?: BabylonOptions): File;
export function parseExpression(input: string, options?: BabylonOptions): Expression;
export interface BabylonOptions {
/**
* By default, import and export declarations can only appear at a program's top level.
* Setting this option to true allows them anywhere where a statement is allowed.
*/
allowImportExportEverywhere?: boolean;
/**
* By default, a return statement at the top level raises an error. Set this to true to accept such code.
*/
allowReturnOutsideFunction?: boolean;
allowSuperOutsideMethod?: boolean;
/**
* Indicate the mode the code should be parsed in. Can be either "script" or "module".
*/
sourceType?: 'script' | 'module';
/**
* Correlate output AST nodes with their source filename. Useful when
* generating code and source maps from the ASTs of multiple input files.
*/
sourceFilename?: string;
/**
* Array containing the plugins that you want to enable.
*/
plugins?: PluginName[];
}
export type PluginName =
'estree' |
'jsx' |
'flow' |
'typescript' |
'classConstructorCall' |
'doExpressions' |
'objectRestSpread' |
'decorators' |
'classProperties' |
'exportExtensions' |
'asyncGenerators' |
'functionBind' |
'functionSent' |
'dynamicImport';
{
"_from": "@types/babylon@^6.16.2",
"_id": "@types/babylon@6.16.5",
"_inBundle": false,
"_integrity": "sha512-xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w==",
"_location": "/@types/babylon",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/babylon@^6.16.2",
"name": "@types/babylon",
"escapedName": "@types%2fbabylon",
"scope": "@types",
"rawSpec": "^6.16.2",
"saveSpec": null,
"fetchSpec": "^6.16.2"
},
"_requiredBy": [
"/constantinople"
],
"_resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.5.tgz",
"_shasum": "1c5641db69eb8cdf378edd25b4be7754beeb48b4",
"_spec": "@types/babylon@^6.16.2",
"_where": "/Users/junyoungjeon/WebstormProjects/mot/backend/node_modules/constantinople",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Troy Gerwien",
"url": "https://github.com/yortus"
},
{
"name": "Marvin Hagemeister",
"url": "https://github.com/marvinhagemeister"
}
],
"dependencies": {
"@types/babel-types": "*"
},
"deprecated": false,
"description": "TypeScript definitions for babylon",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/babylon",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"typeScriptVersion": "2.8",
"types": "index",
"typesPublisherContentHash": "d6861e06508c0c54a6a46d7b72e96db7907de3621ac44aab8a3e647b8431cddd",
"version": "6.16.5"
}
MIT License
Copyright (c) Microsoft Corporation.
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment