diff --git a/src/server.js b/src/server.js index 334e1de..e1d84d1 100644 --- a/src/server.js +++ b/src/server.js @@ -9,11 +9,6 @@ let app = express() app.use(cors()) app.use(bodyParser.json()) -// verify JWT token middleware -app.use((req, res, next) => { - -}) - // For ease of this tutorial, we are going to use SQLite to limit dependencies let database = new Sequelize({ dialect: 'sqlite', @@ -22,10 +17,10 @@ let database = new Sequelize({ // Define our Post model // id, createdAt, and updatedAt are added by sequelize automatically -let Post = database.define('posts', { - title: Sequelize.STRING, - body: Sequelize.TEXT -}) +var User = database.define('User', { + username: Sequelize.STRING, + requested_resturant: Sequelize.DATE +}); // Initialize finale finale.initialize({ @@ -34,16 +29,24 @@ finale.initialize({ }) // Create the dynamic REST resource for our Post model -let userResource = finale.resource({ - model: Post, - endpoints: ['/posts', '/posts/:id'] -}) +var userResource = finale.resource({ + model: User, + endpoints: ['/users', '/users/:id'] +}); + +userResource.create +userResource.list +userResource.read +userResource.update // Resets the database and launches the express app on :8081 database .sync({ force: true }) .then(() => { + app.listen(8081, () => { console.log('listening to port localhost:8081') }) - }) \ No newline at end of file + }) + + \ No newline at end of file