GithubHelp home page GithubHelp logo

express's Introduction

express

使用express框架;
添加mysql,nomalize;
密码采用md5加密;
嵌入式ejs运用;
数据库信息:

    const DB = {
    host: "localhost",
    port: 3306,
    user: "user",
    password: "password",
    database: "name"
};

session配置:

app.use(session({
    secret: 'name',
    cookie: { maxAge: 1000 * 60 * 24 * 30 },
    resave: false,
    saveUninitialized: true,
}));

session配置在app.js文件中放在router前


文章倒序采用

SELECT * FROM article ORDER BY articleID DESC

将时间改为北京0000-00-00时间:

var year = ele.articleTime.getFullYear();
           var month = ele.articleTime.getMonth() + 1 > 10 ? ele.articleTime.getMonth() : '0' + (ele.articleTime.getMonth() + 1);
           var date = ele.articleTime.getDate() > 10 ? ele.articleTime.getDate() : '0' + ele.articleTime.getDate();
           ele.articleTime = year + '-' + month + '-' + date;

写入文章:

INSERT article SET articleTitle

express's People

Contributors

tumimsaki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.